1

chef_zero在 OpsCode工具中测试配置程序时test-kitchen,我看到以下错误:

$ 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.

我该如何解决?

4

1 回答 1

2

问题可能是用于平台的便当盒没有预先安装足够新版本的厨师。因此,使用provisioner的标志不可用!test-kitchenubuntu-1004-zchef_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 便当盒。正如@sethvargo 指出的那样,较新的便当盒都是无供应的。如果是这种情况,您可以尝试通过先移动旧的缓存框来修复它,然后重试kitchen test命令:

mv ~/.vagrant.d/boxes/opscode-ubuntu-10.04 ~/.vagrant.d/tmp/opscode-ubuntu-10.04
bundle exec kitchen test ubuntu-1004 -d never

如果这解决了您的问题,那么您的系统上有一个错误的缓存框!

于 2014-06-11T04:08:49.773 回答