Chef Kitchen + Vagrant Window7盒因SSH而失败

时间:2015-01-29 16:25:35

标签: windows vagrant chef test-kitchen

日志信息:

 -----> 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:

$ vagrant box list

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后表示虚拟机正在运行但无法连接:

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

1 个答案:

答案 0 :(得分:1)

根据Matt Wrock的this excellent blog post,您需要使用最先进的测试厨房和厨房 - 流浪汉。在Matt Wrock的帮助下,他帮助了我figure out which versions

tl; dr是:

如果您在食谱中使用Gemfile,则可以使用Bundler的git dependency支持来提取这些正确的分支/分叉。如果你只使用没有Bundler的Chef-DK,你需要更换Chef-DK运送的测试厨房和厨房 - 流浪汉