我一直试图将我的测试食谱与厨师厨师合并。
我尝试过修改设置并使用不同的流浪盒以及“打包”我自己的。但每次我仍然得到这个错误:
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [[WinRM::Transport::FileTransporter] Upload failed (exitcode: 1)
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">The term 'Function' is not recognized as the name of a cmdlet, function, script_x000D__x000A_</S><S S="Error"> file, or operable program. Check the spelling of the name, or if a path was in_x000D__x000A_</S><S S="Error">cluded, verify that the path is correct and try again._x000D__x000A_</S><S S="Error">At line:3 char:2_x000D__x000A_</S><S S="Error">+ . <<<< Function Cleanup($o) { if (($o) -and ($o.GetType().GetMethod("Dispose_x000D__x000A_</S><S S="Error">") -ne $null)) { $o.Dispose() } }_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (Function:String) [], CommandNot _x000D__x000A_</S><S S="Error"> FoundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Exception calling "FromBase64String" with "1" argument(s): "Invalid character i_x000D__x000A_</S><S S="Error">n a Base-64 string."_x000D__x000A_</S><S S="Error">At line:4 char:114_x000D__x000A_</S><S S="Error">+ Function Decode-Base64File($src, $dst) {set-content -Encoding Byte -Path $dst_x000D__x000A_</S><S S="Error"> -Value ([Convert]::FromBase64String <<<< ([IO.File]::ReadAllLines($src)))}_x000D__x000A_</S><S S="Error"> + CategoryInfo : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Get-Item : Cannot find path 'C:\Users\vagrant\AppData\Local\Temp\tmpzip-3395dca_x000D__x000A_</S><S S="Error">1ace537199fc6ec84fb894f56.zip' because it does not exist._x000D__x000A_</S><S S="Error">At line:30 char:45_x000D__x000A_</S><S S="Error">+ $bytes = $c.ComputeHash(($in = (Get-Item <<<< $src).OpenRead()))_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (C:\Users\vagran...c84fb894f56.z _x000D__x000A_</S><S S="Error"> ip:String) [Get-Item], ItemNotFoundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetIt _x000D__x000A_</S><S S="Error"> emCommand_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">The term 'Cleanup' is not recognized as the name of a cmdlet, function, script _x000D__x000A_</S><S S="Error">file, or operable program. Check the spelling of the name, or if a path was inc_x000D__x000A_</S><S S="Error">luded, verify that the path is correct and try again._x000D__x000A_</S><S S="Error">At line:32 char:50_x000D__x000A_</S><S S="Error">+ } catch [exception]{throw $_} finally { Cleanup <<<< $c; Cleanup $in }_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (Cleanup:String) [], CommandNotF _x000D__x000A_</S><S S="Error"> oundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">The term 'Cleanup' is not recognized as the name of a cmdlet, function, script _x000D__x000A_</S><S S="Error">file, or operable program. Check the spelling of the name, or if a path was inc_x000D__x000A_</S><S S="Error">luded, verify that the path is correct and try again._x000D__x000A_</S><S S="Error">At line:32 char:62_x000D__x000A_</S><S S="Error">+ } catch [exception]{throw $_} finally { Cleanup $c; Cleanup <<<< $in }_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (Cleanup:String) [], CommandNotF _x000D__x000A_</S><S S="Error"> oundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">You cannot call a method on a null-valued expression._x000D__x000A_</S><S S="Error">At line:30 char:60_x000D__x000A_</S><S S="Error">+ $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead <<<< ()))_x000D__x000A_</S><S S="Error"> + CategoryInfo : InvalidOperation: (OpenRead:String) [], RuntimeE _x000D__x000A_</S><S S="Error"> xception_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : InvokeMethodOnNull_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
这是屏幕输出:
-----> Starting Kitchen (v1.4.0)
-----> Creating <default-windows-2008r2>...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'windows-2008r2'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: kitchen-my_cookbook-default-windows-2008r2_default_1439924218684_94584
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 3389 => 3389 (adapter 1)
default: 5985 => 5985 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes... default: WinRM address: 127.0.0.1:5985
default: WinRM username: vagrant
default: WinRM transport: plaintext
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Machine not provisioned because `--no-provision` is specified.
[WinRM] Established
Vagrant instance <default-windows-2008r2> created.
Finished creating <default-windows-2008r2> (1m20.27s).
-----> Converging <default-windows-2008r2>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 3.2.4...
Removing non-cookbook files before transfer
Preparing solo.rb
-----> Installing Chef Omnibus (install only if missing)
Downloading package from https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-client-12.4.1-1.msi
Download complete.
Successfully verified C:\Users\vagrant\AppData\Local\Temp\chef-true.msi
Installing Chef Omnibus package C:\Users\vagrant\AppData\Local\Temp\chef-true.msi
Installation complete
Transferring files to <default-windows-2008r2>
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [[WinRM::Transport::FileTransporter] Upload failed (exitcode: 1)
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">The term 'Function' is not recognized as the name of a cmdlet, function, script_x000D__x000A_</S><S S="Error"> file, or operable program. Check the spelling of the name, or if a path was in_x000D__x000A_</S><S S="Error">cluded, verify that the path is correct and try again._x000D__x000A_</S><S S="Error">At line:3 char:2_x000D__x000A_</S><S S="Error">+ . <<<< Function Cleanup($o) { if (($o) -and ($o.GetType().GetMethod("Dispose_x000D__x000A_</S><S S="Error">") -ne $null)) { $o.Dispose() } }_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (Function:String) [], CommandNot _x000D__x000A_</S><S S="Error"> FoundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Exception calling "FromBase64String" with "1" argument(s): "Invalid character i_x000D__x000A_</S><S S="Error">n a Base-64 string."_x000D__x000A_</S><S S="Error">At line:4 char:114_x000D__x000A_</S><S S="Error">+ Function Decode-Base64File($src, $dst) {set-content -Encoding Byte -Path $dst_x000D__x000A_</S><S S="Error"> -Value ([Convert]::FromBase64String <<<< ([IO.File]::ReadAllLines($src)))}_x000D__x000A_</S><S S="Error"> + CategoryInfo : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Get-Item : Cannot find path 'C:\Users\vagrant\AppData\Local\Temp\tmpzip-3395dca_x000D__x000A_</S><S S="Error">1ace537199fc6ec84fb894f56.zip' because it does not exist._x000D__x000A_</S><S S="Error">At line:30 char:45_x000D__x000A_</S><S S="Error">+ $bytes = $c.ComputeHash(($in = (Get-Item <<<< $src).OpenRead()))_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (C:\Users\vagran...c84fb894f56.z _x000D__x000A_</S><S S="Error"> ip:String) [Get-Item], ItemNotFoundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetIt _x000D__x000A_</S><S S="Error"> emCommand_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">The term 'Cleanup' is not recognized as the name of a cmdlet, function, script _x000D__x000A_</S><S S="Error">file, or operable program. Check the spelling of the name, or if a path was inc_x000D__x000A_</S><S S="Error">luded, verify that the path is correct and try again._x000D__x000A_</S><S S="Error">At line:32 char:50_x000D__x000A_</S><S S="Error">+ } catch [exception]{throw $_} finally { Cleanup <<<< $c; Cleanup $in }_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (Cleanup:String) [], CommandNotF _x000D__x000A_</S><S S="Error"> oundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">The term 'Cleanup' is not recognized as the name of a cmdlet, function, script _x000D__x000A_</S><S S="Error">file, or operable program. Check the spelling of the name, or if a path was inc_x000D__x000A_</S><S S="Error">luded, verify that the path is correct and try again._x000D__x000A_</S><S S="Error">At line:32 char:62_x000D__x000A_</S><S S="Error">+ } catch [exception]{throw $_} finally { Cleanup $c; Cleanup <<<< $in }_x000D__x000A_</S><S S="Error"> + CategoryInfo : ObjectNotFound: (Cleanup:String) [], CommandNotF _x000D__x000A_</S><S S="Error"> oundException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">You cannot call a method on a null-valued expression._x000D__x000A_</S><S S="Error">At line:30 char:60_x000D__x000A_</S><S S="Error">+ $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead <<<< ()))_x000D__x000A_</S><S S="Error"> + CategoryInfo : InvalidOperation: (OpenRead:String) [], RuntimeE _x000D__x000A_</S><S S="Error"> xception_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : InvokeMethodOnNull_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
这是我的.kitchen.yml
:
---
driver:
name: vagrant
forward_agent: yes
communicator: winrm
guest: windows
provisioner:
name: chef_solo
password: vagrant
username: vagrant
transport:
name: winrm
platforms:
- name: windows-2008r2
driver_config:
vm_hostname: false
guest: windows
communicator: winrm
os_type: windows
shell_type: powershell
transport:
name: winrm
suites:
- name: default
run_list:
- recipe[my_cookbook::default]
attributes:
这是我的metadata.rb
:
name 'my_cookbook'
maintainer 'The Authors'
maintainer_email 'you@example.com'
license 'all_rights'
description 'Installs/Configures my_cookbook'
long_description 'Installs/Configures my_cookbook'
version '0.1.0'
depends 'apt', '~> 2.7.0'
depends 'java', '~> 1.35.0'
这是我的recipes/default.rb
:
cookbook_file '/tmp/kitchen/cache/server-jre-8u51-linux-x64.tar.gz' do
source 'server-jre-8u51-linux-x64.tar.gz'
action :create
end
include_recipe 'apt'
include_recipe 'java'
这是我的attributes/default.rb
:
node.override[:java][:jdk_version] = '8'
node.override[:java][:install_flavor] = 'oracle'
node.default['java']['jdk']['8']['x86_64']['url'] = 'file://server-jre-8u51-linux-x64.tar.gz'
我已经尝试过这些教程,但现在我只是坚持:
http://kitchen.ci/blog/test-kitchen-windows-test-flight-with-vagrant/
http://www.hurryupandwait.io/blog/orchestrating-multi-server-tests-in-test-kitchen
请让我知道我还可以尝试解决此问题。
感谢您的时间!
我已达到StackOverflow字符数限制,因此我在kitchen.log
附加了kitchen diagnose --all
和<{1}}的输出: