在OpsCode test-kitchen
工具中测试chef_zero
配置程序时,我看到以下错误:
$ bundle exec kitchen test
-----> Starting Kitchen (v1.1.1)
-----> Cleaning up any prior instances of <default-ubuntu-1004>
-----> Destroying <default-ubuntu-1004>...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
Vagrant instance <default-ubuntu-1004> destroyed.
Finished destroying <default-ubuntu-1004> (0m4.62s).
-----> Testing <default-ubuntu-1004>
-----> Creating <default-ubuntu-1004>...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'opscode-ubuntu-10.04'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: default-ubuntu-1004_default_1402458172208_54996
Skipping Berkshelf with --no-provision
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
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: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.6
default: VirtualBox Version: 4.3
==> default: Setting hostname...
==> default: Machine not provisioning because `--no-provision` is specified.
Vagrant instance <default-ubuntu-1004> created.
Finished creating <default-ubuntu-1004> (0m36.52s).
-----> Converging <default-ubuntu-1004>...
Preparing files for transfer
Resolving cookbook dependencies with Berkshelf...
Removing non-cookbook files before transfer
Transfering files to <default-ubuntu-1004>
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-cli-1.3.0/lib/mixlib/cli.rb:226:in `parse_options': invalid option: -z (OptionParser::InvalidOption)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.2.0/lib/chef/application.rb:78:in `configure_chef'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.2.0/lib/chef/application.rb:65:in `reconfigure'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.2.0/lib/chef/application/client.rb:217:in `reconfigure'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.2.0/lib/chef/application.rb:71:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.2.0/bin/chef-client:26:in `<top (required)>'
from /usr/bin/chef-client:23:in `load'
from /usr/bin/chef-client:23:in `<main>'
>>>>>> Converge failed on instance <default-ubuntu-1004>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1004.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-client -z --config /tmp/kitchen/client.rb --json-attributes /tmp/kitchen/dna.json --log_level info]
>>>>>> ----------------------
似乎正在使用chef-client
标记运行-z
,但它返回的错误是invalid option
。
我该如何解决这个问题?
答案 0 :(得分:2)
问题可能是test-kitchen
ubuntu-1004
用于平台-z
的{{3}}未预先安装足够新版本的厨师。因此,使用chef_zero
配置程序的require_chef_omnibus: latest
标志不可用!
要解决此问题,请务必在.kitchen.yml
中设置---
driver:
name: vagrant
driver_config:
require_chef_omnibus: latest
provisioner:
name: chef_zero
platforms:
- name: ubuntu-10.04
- name: ubuntu-12.04
- name: ubuntu-12.10
- name: ubuntu-13.04
- name: ubuntu-13.10
suites:
- name: default
run_list:
- recipe[make-me-a-sammich::default]
attributes:
:
ubuntu-1004
修改强>
也可能是您在本地缓存了旧版本的OpsCode kitchen test
便携盒。 @sethvargo指出,新的便当盒都是无装备的。如果是这种情况,您可以先尝试移动旧的缓存框,然后重新尝试mv ~/.vagrant.d/boxes/opscode-ubuntu-10.04 ~/.vagrant.d/tmp/opscode-ubuntu-10.04
bundle exec kitchen test ubuntu-1004 -d never
命令来修复它:
{{1}}
如果这样可以解决您的问题,那么系统上的缓存框就会很糟糕!