Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to set get the "guest" option set in the generated Vagrantfile #28

Closed
kashook opened this issue Jun 21, 2013 · 7 comments
Closed

Comments

@kashook
Copy link

kashook commented Jun 21, 2013

I am attempting to use test kitchen to bring up a windows guest. In order for the vagrant-windows plugin to be able to do its job, the "guest" option needs to be set to :windows in the Vagrantfile. For example:

Vagrant.configure("2") do |c|
  c.vm.box = "my_windows_box"
  c.vm.box_url = "http://someplace/my_windows_box.box"
  c.vm.guest = :windows   # <-- Need to set this
  #... more settings
end

I've successfully been able to get a windows VM to come up and for chef to successfully run a recipe that I want to test by hacking my installed copy of kitchen-vagrant to write the guest setting into the Vagrantfile. (I also used the existing use_vagrant_provision: true setting, just in case anyone else comes across this and wonders how I was able to get it to work). As far as I can tell so far, this one small issue is the only thing that would prevent people from being able to use test kitchen with windows guests.

@fnichol
Copy link
Contributor

fnichol commented Jul 22, 2013

Looks resolved as #29 is merged. Thank you, nice add!

@fnichol fnichol closed this as completed Jul 22, 2013
@kashook
Copy link
Author

kashook commented Jul 22, 2013

Great news, thanks!

@tim95030
Copy link

tim95030 commented Dec 9, 2013

How did you get test-kitchen to use vagrant-windows?

I have been trying to get mine to connect via winrm but no matter what I do it tries ssh. I have included the kitchen.yml and the error log. It works fine when I use vagrant up.

Here is my kitchen file:

---
driver:
  name: vagrant

driver_config:
  use_vagrant_provision: true

provisioner:
  name: chef_solo

platforms:
  - name: windows7-ultimate
    driver_config:
      box: windows7_ultimate
      guest: :windows

suites:
  - name: default
    run_list:
      - recipe[windows-ua::default]
    attributes:

Error_Log:

I, [2013-12-09T11:19:21.460217 #30448]  INFO -- default-windows7-ultimate: -----> Creating <default-windows7-ultimate>...
I, [2013-12-09T11:19:29.077740 #30448]  INFO -- default-windows7-ultimate: Bringing machine 'default' up with 'virtualbox' provider...
I, [2013-12-09T11:19:31.281681 #30448]  INFO -- default-windows7-ultimate: [default] Importing base box 'windows7_ultimate'...
I, [2013-12-09T11:23:15.708557 #30448]  INFO -- default-windows7-ultimate: 
[default] Matching MAC address for NAT networking...
I, [2013-12-09T11:23:16.953306 #30448]  INFO -- default-windows7-ultimate: [default] Setting the name of the VM...
I, [2013-12-09T11:23:17.064328 #30448]  INFO -- default-windows7-ultimate: [default] Clearing any previously set forwarded ports...
I, [2013-12-09T11:23:17.174851 #30448]  INFO -- default-windows7-ultimate: [Berkshelf] Skipping Berkshelf with --no-provision
I, [2013-12-09T11:23:20.592034 #30448]  INFO -- default-windows7-ultimate: [default] Creating shared folders metadata...
I, [2013-12-09T11:23:20.592034 #30448]  INFO -- default-windows7-ultimate: [default] Clearing any previously set network interfaces...
I, [2013-12-09T11:23:20.683052 #30448]  INFO -- default-windows7-ultimate: [default] Preparing network interfaces based on configuration...
I, [2013-12-09T11:23:20.763568 #30448]  INFO -- default-windows7-ultimate: [default] Forwarding ports...
I, [2013-12-09T11:23:20.873590 #30448]  INFO -- default-windows7-ultimate: [default] -- 22 => 2222 (adapter 1)
I, [2013-12-09T11:23:20.873590 #30448]  INFO -- default-windows7-ultimate: [default] -- 3389 => 3395 (adapter 1)
I, [2013-12-09T11:23:20.873590 #30448]  INFO -- default-windows7-ultimate: [default] -- 5985 => 5985 (adapter 1)
I, [2013-12-09T11:23:21.184652 #30448]  INFO -- default-windows7-ultimate: [default] Running 'pre-boot' VM customizations...
I, [2013-12-09T11:23:21.285172 #30448]  INFO -- default-windows7-ultimate: [default] Booting VM...
I, [2013-12-09T11:23:22.112338 #30448]  INFO -- default-windows7-ultimate: [default] Waiting for machine to boot. This may take a few minutes...
I, [2013-12-09T11:24:23.305074 #30448]  INFO -- default-windows7-ultimate: [default] Machine booted and ready!
I, [2013-12-09T11:24:23.386090 #30448]  INFO -- default-windows7-ultimate: [default] Setting hostname...
[default] Mounting shared folders...I, [2013-12-09T11:24:28.385590 #30448]  INFO -- default-windows7-ultimate: 
I, [2013-12-09T11:24:44.402293 #30448]  INFO -- default-windows7-ultimate: Vagrant instance <default-windows7-ultimate> created.
I, [2013-12-09T11:24:44.410794 #30448]  INFO -- default-windows7-ultimate: Finished creating <default-windows7-ultimate> (5m22.94s).
I, [2013-12-09T11:24:44.411294 #30448]  INFO -- default-windows7-ultimate: -----> Converging <default-windows7-ultimate>...
I, [2013-12-09T11:24:44.413795 #30448]  INFO -- default-windows7-ultimate: Preparing files for transfer
I, [2013-12-09T11:24:44.423797 #30448]  INFO -- default-windows7-ultimate: Resolving cookbook dependencies with Berkshelf...
I, [2013-12-09T11:24:48.822176 #30448]  INFO -- default-windows7-ultimate: Removing non-cookbook files before transfer
E, [2013-12-09T11:24:48.991210 #30448] ERROR -- default-windows7-ultimate: Converge failed on instance <default-windows7-ultimate>.
E, [2013-12-09T11:24:48.991710 #30448] ERROR -- default-windows7-ultimate: ------Exception-------
E, [2013-12-09T11:24:48.991710 #30448] ERROR -- default-windows7-ultimate: Class: Kitchen::ActionFailed
E, [2013-12-09T11:24:48.991710 #30448] ERROR -- default-windows7-ultimate: Message: vagrant
E, [2013-12-09T11:24:48.991710 #30448] ERROR -- default-windows7-ultimate: ---Nested Exception---
E, [2013-12-09T11:24:48.991710 #30448] ERROR -- default-windows7-ultimate: Class: Net::SSH::AuthenticationFailed
E, [2013-12-09T11:24:48.991710 #30448] ERROR -- default-windows7-ultimate: Message: vagrant
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: ------Backtrace-------
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/driver/ssh_base.rb:110:in `rescue in run_remote'
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/driver/ssh_base.rb:106:in `run_remote'
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/driver/ssh_base.rb:43:in `block in converge'
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/ssh.rb:47:in `initialize'
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/driver/ssh_base.rb:42:in `new'
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/driver/ssh_base.rb:42:in `converge'
E, [2013-12-09T11:24:48.992210 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/kitchen-vagrant-0.13.0/lib/kitchen/driver/vagrant.rb:71:in `converge'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:273:in `public_send'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:273:in `block in perform_action'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:308:in `call'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:308:in `synchronize_or_call'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:283:in `block in action'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:282:in `action'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:273:in `perform_action'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:256:in `converge_action'
E, [2013-12-09T11:24:48.992710 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:246:in `block in transition_to'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:245:in `each'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:245:in `transition_to'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/instance.rb:119:in `converge'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:314:in `public_send'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:314:in `block in run_serial'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:314:in `map'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:314:in `run_serial'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:308:in `block in exec_action'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:305:in `exec_action'
E, [2013-12-09T11:24:48.993211 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:108:in `block (2 levels) in <class:CLI>'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/cli.rb:288:in `invoke_task'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/bin/kitchen:13:in `block in <top (required)>'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/lib/kitchen/errors.rb:81:in `with_friendly_errors'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/test-kitchen-1.1.0/bin/kitchen:13:in `<top (required)>'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/bin/kitchen:23:in `load'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: c:/opscode/chef/embedded/bin/kitchen:23:in `<main>'
E, [2013-12-09T11:24:48.993711 #30448] ERROR -- default-windows7-ultimate: ----------------------

@kashook
Copy link
Author

kashook commented Dec 10, 2013

@tim95030, the last time I created a kitchen test for a windows guest, I was using test-kitchen 1.0.0.beta.3 and kitchen-vagrant 0.11.1. I just ran the tests that I had created against those versions to confirm that they still work, and they do. I then upgraded to test-kitchen 1.1.1 and kitchen-vagrant 0.14.0 and re-ran the tests. When I run my tests against the new versions, I also get an SSH error. So, it would appear something has changed.

When I was originally trying to get this to work (using the beta), I specifically had to add the guest: :windows and use_vagrant_provision: true settings (which you have done), and I also added the require_chef_omnibus: false setting underneath driver_config. Without the use_vagrant_provision setting, it would try to use SSH and fail if I remember correctly. When I turned on debug logging after upgrading to the latest versions, I got this:

...

-----> Converging <default-windows-server2008R2-x64-chef-11>...
       Preparing files for transfer
D      Creating local sandbox in C:/Users/keiths/AppData/Local/Temp/1/default-windows-server2008R2-x64-chef-11-sandbox-20131210-3088-1s7b13m
       Resolving cookbook dependencies with Berkshelf...
D      Using Berksfile from D:/hg/DA/Cookbooks/windows_command_runner/Berksfile
       Removing non-cookbook files before transfer
D      [SSH] vagrant@127.0.0.1:2202<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :keys_only=>true, :port=>"2202", :keys=>["C:/Users/keiths/.vagrant.d/insecure_private_key"]}> (sudo -E rm -rf /tmp/kitchen/cookbooks /tmp/kitchen/data /tmp/kitchen/data_bags /tmp/kitchen/environments /tmp/kitchen/roles ; mkdir -p /tmp/kitchen)
D      [SSH] opening connection to vagrant@127.0.0.1:2202<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :keys_only=>true, :port=>"2202", :keys=>["C:/Users/keiths/.vagrant.d/insecure_private_key"]}>
       [SSH] connection failed, retrying (#<Net::SSH::Disconnect: connection closed by remote host>)
D      [SSH] opening connection to vagrant@127.0.0.1:2202<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :keys_only=>true, :port=>"2202", :keys=>["C:/Users/keiths/.vagrant.d/insecure_private_key"], :user=>"vagrant"}>
       [SSH] connection failed, retrying (#<Net::SSH::Disconnect: connection closed by remote host>)
D      [SSH] opening connection to vagrant@127.0.0.1:2202<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :keys_only=>true, :port=>"2202", :keys=>["C:/Users/keiths/.vagrant.d/insecure_private_key"], :user=>"vagrant"}>
$$$$$$ [SSH] connection failed, terminating (#<Net::SSH::Disconnect: connection closed by remote host>)
D      Cleaning up local sandbox in C:/Users/keiths/AppData/Local/Temp/1/default-windows-server2008R2-x64-chef-11-sandbox-20131210-3088-1s7b13m
>>>>>> Converge failed on instance <default-windows-server2008R2-x64-chef-11>.
>>>>>> Please see .kitchen/logs/default-windows-server2008R2-x64-chef-11.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: connection closed by remote host
>>>>>> ----------------------
...

It almost looks as if it's not using vagrant to do the provisioning, despite having the use_vagrant_provision: true enabled.

At some point I will end up investigating what changed. If I figure it out, I'll post here. However, if you beat me to it, I'd appreciate if you did the same. :)

@kashook
Copy link
Author

kashook commented Jan 6, 2014

Just to follow up on my previous post, I did a bit of research and found that the use_vagrant_provision option was removed by this changeset. With that setting removed, test kitchen tries to do the provisioning itself by talking to the VM with SSH. So, it would appear that it's no longer possible to run tests against Windows VMs unfortunately.

@rtacconi
Copy link

I wonder why after 4 months we are still not able to run Windows from test kitchen 4993a1b

Any idea on how to do that?

@afiune
Copy link

afiune commented Mar 7, 2014

I'm on the same path!

Just had a timeout error:
STDERR: c:/HashiCorp/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:54:in timeout': undefined method zero?' for #<Object:0x384b6d0> (NoMethodError) from C:/Users/salim.afiune/.vagrant.d/gems/gems/vagrant-windows-1.5.1/lib/vagrant-windows/communication/winrmcommunicator.rb:29:in ready?'

I'm still trying this thing to work..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants