Chef Kitchen + Vagrant Window7 box 由于 SSH 而失败

Chef Kitchen + Vagrant Window7 box failing due to SSH

日志信息:

 -----> Starting Kitchen (v1.2.1)
 -----> Creating <default-windows>...
   Bringing machine 'default' up with 'virtualbox' provider...
   ==> default: Importing base box 'windows'...
   ==> default: Matching MAC address for NAT networking...
   ==> default: Setting the name of the VM: default-   windows_default_1422548310230_74071
   ==> default: Fixed port collision for 22 => 2222. Now on port 2202.
   ==> default: Clearing any previously set network interfaces...
   ==> default: Preparing network interfaces based on configuration...
       default: Adapter 1: nat
       default: Adapter 2: hostonly
   ==> default: Forwarding ports...
       default: 22 => 2202 (adapter 1)
   ==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...           default: SSH address: 127.0.0.1:2202
       default: SSH username: vagrant
       default: SSH auth method: private key
       default: Warning: Connection timeout. Retrying...
       default: Warning: Connection timeout. Retrying...
       default: Warning: Connection timeout. Retrying...
       default: Warning: Connection timeout. Retrying...

我的kitchen.yml:

---
driver_plugin: vagrant
driver_config:
  require_chef_omnibus: true
  network:
  - ['private_network', {ip: '192.168.33.33'}]

provisioner:
  name: chef_zero

platforms:
  - name: windows
    driver:
      box: windows
      communicator: winrm
    driver_config:
      gui: true

suites:
  - name: default
    run_list:
      - recipe[tcserver::java-for-tcserver]
      - recipe[tcserver::default]
    attributes:

$ 流浪框列表

bseller/santiago      (virtualbox, 1.0.0)
chef/centos-6.5       (virtualbox, 1.0.0)
chef/centos-6.5       (vmware_desktop, 1.0.0)
chef/ubuntu-14.04     (virtualbox, 1.0.0)
hashicorp/precise32   (virtualbox, 1.0.0)
hashicorp/precise64   (virtualbox, 1.1.0) 
learningchef/centos65 (virtualbox, 1.0.7)
opscode-centos-6.5    (virtualbox, 0) 
opscode-ubuntu-12.04  (virtualbox, 0)
opscode-ubuntu-14.04  (virtualbox, 0)
pcf-immersion-box     (virtualbox, 0)
suse/sles11sp3        (virtualbox, 0.1.7) 
ubuntu-chef           (virtualbox, 0)
ubuntu-ruby-chef      (virtualbox, 0)
ubuntu/trusty32       (virtualbox, 14.04)
ubuntu1204            (virtualbox, 0)
vista-ie7             (virtualbox, 0)
windows               (virtualbox, 0)
windows8              (virtualbox, 0)

我从 kitchen converge

生成的 Vagrantfile
Vagrant.configure("2") do |c|
  c.vm.box = "windows"
  c.vm.box_url = "https://opscode-vm-    bento.s3.amazonaws.com/vagrant/virtualbox/opscode_windows_chef-provisionerless.box"
  c.vm.hostname = "default-windows.vagrantup.com"
  c.vm.network(:private_network, {:ip=>"192.168.33.33"})
  c.vm.synced_folder ".", "/vagrant", disabled: true
  c.vm.provider :virtualbox do |p|
  end
end

我能够成功 运行 厨房汇集在 centos/rhel/ubuntu 盒子上。这似乎完全是一个 windows 问题(像往常一样)。

我在 kitchen.yml 中的指令似乎没有被翻译成 Vagrantfile。

kitchen converge 之后的 运行 表示 VM 正在 运行ning 但无法连接:

[SSH] connection failed, retrying (#<Net::SSH::Disconnect: connection closed by remote host>)

根据 this excellent blog post from Matt Wrock, you need to use cutting edge test-kitchen and kitchen-vagrant. With all credit to Matt Wrock, he helped me figure out which versions.

tl;dr 是:

如果您在食谱中使用 Gemfile,则可以使用 Bundler 的 git dependency 支持来引入这些正确的 branches/forks。如果您只使用 Chef-DK 而没有 Bundler,则需要更换 Chef-DK 附带的 test-kitchen 和 kitchen-vagrant