0

日志信息:

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

我的厨房.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)

我生成的 Vagrantfile 来自kitchen converge

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 正在运行但无法连接:

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

1 回答 1

1

根据Matt Wrock的这篇出色的博客文章,您需要使用最先进的 test-kitchen 和 kitchen-vagrant。归功于 Matt Wrock,他帮助我找出了哪些版本

tl;博士是:

如果你Gemfile在你的食谱中使用 a,你可以使用 Bundler 的git 依赖支持来拉入这些正确的分支/分支。如果您只使用没有 Bundler 的 Chef-DK,则需要替换 Chef-DK 随附的 test-kitchen 和 kitchen-vagrant

于 2015-02-09T04:29:17.360 回答