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

use Vagrant core API for waiting of communicator #162

Merged
2 commits merged into from
Jan 21, 2016
Merged

use Vagrant core API for waiting of communicator #162

2 commits merged into from
Jan 21, 2016

Conversation

mkuzmin
Copy link
Contributor

@mkuzmin mkuzmin commented Dec 5, 2015

This is a fix for WinRM connection issue in #144.
Vagrant core now provides a common method for waiting of guest machine loading and communicator initialization. It supports both SSH and WinRM, so there is no need to keep a custom code in the plugin anymore.

@mkuzmin
Copy link
Contributor Author

mkuzmin commented Dec 5, 2015

  1. Rubocop rules with exact number of required lines look strange. I changed the number to pass the test, but it doesn't seem a reliable solution.
  2. it could be useful to execute RSpec tests, even if Rubocop failed in a first step.

@taliesins
Copy link
Contributor

+1 please get this merged ASAP :>

@ggascoigne
Copy link

+1, this greatly improves things for me.

@mprahl
Copy link

mprahl commented Jan 6, 2016

+1

@mkuzmin
Copy link
Contributor Author

mkuzmin commented Jan 16, 2016

@michaeljb this fix is rather critical for using Vagrant with Windows guests. Can we have a new release please?

@viktorbenei
Copy link

+1

@pvanbuijtene
Copy link

I used this PR but I'm still getting the "The box is not able to report an address for WinRM to connect to yet." message.

I'm curious if it's working succesfully for anybody?

I'm using:
vSphere 5.5
vagrant 1.7.4
vagrant-vsphere: master + this PR

My current guess is that something is (still) going wrong with obtaining the IP address of the machine.

Here's a part of the debug logging:

INFO interface: output: Waiting for machine to boot. This may take a few minutes...
 INFO interface: output: ==> default: Waiting for machine to boot. This may take a few minutes...
DEBUG provider: Searching for cap: winrm_info
 INFO machine: Calling action: get_state on provider vSphere (42397614-7257-0b30-1160-7841f1ee34a7)
==> default: Waiting for machine to boot. This may take a few minutes...DEBUG provider: Checking in: vsphere

 INFO runner: Preparing hooks for middleware sequence...
 INFO machine: Calling action: get_ssh_info on provider vSphere (42397614-7257-0b30-1160-7841f1ee34a7)
 INFO runner: 2 hooks defined.
 INFO runner: Running action: machine_action_get_state #<Vagrant::Action::Builder:0x4e2aae0>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::HandleBox:0x4e31bd8>
 INFO handle_box: Machine already has box. HandleBox will not run.
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x4e61110>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x4e610f8>
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 2 hooks defined.
 INFO runner: Running action: machine_action_get_ssh_info #<Vagrant::Action::Builder:0x4e32868>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x4e9bf70>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x4e9bf40>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::GetState:0x4e610e0>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::GetSshInfo:0x4e9bf28>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x4e610b0>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x4e610b0>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::GetState:0x4e610e0>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x4e610f8>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::ConfigValidate:0x4e61110>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::HandleBox:0x4e31bd8>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x4e9bf10>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x4e9bf10>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::GetSshInfo:0x4e9bf28>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x4e9bf40>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::ConfigValidate:0x4e9bf70>
ERROR warden: Error occurred: The box is not able to report an address for WinRM to connect to yet.
WinRM cannot access this Vagrant environment. Please wait for the
Vagrant environment to be running and try again.

@pvanbuijtene
Copy link

Think I found the problem, obtaining an IP address takes more then 30 seconds... :(

@rhass-r7
Copy link

I too am not able to get this patch working against Vagrant 1.7.4 and vagrant-vsphere 1.5.0.

==> default: New virtual machine successfully cloned
 INFO warden: Calling IN action: #<Proc:0x000000038c9030@/opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:94 (lambda)>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::Call:0x0000000214bd90>
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: machine_action_up #<Vagrant::Action::Builder:0x000000040baf50>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::IsRunning:0x000000040b8278>
 INFO machine: Calling action: get_state on provider vSphere (420a0ffd-dd47-861b-9927-24f8dc7b198d)
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: machine_action_get_state #<Vagrant::Action::Builder:0x000000040d7c40>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::HandleBox:0x000000040d4d88>
 INFO handle_box: Machine already has box. HandleBox will not run.
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000040ee620>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x000000040ee5f8>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::GetState:0x000000040ee5d0>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x000000040ee5a8>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x000000040ee5a8>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::GetState:0x000000040ee5d0>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x000000040ee5f8>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000040ee620>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::HandleBox:0x000000040d4d88>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::IsRunning:0x000000040b8278>
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: machine_action_up #<Vagrant::Action::Warden:0x000000041de2d8>
 INFO warden: Calling IN action: #<Proc:0x000000041fba40@/opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:94 (lambda)>
 INFO warden: Calling IN action: #<Proc:0x000000041df728@/opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/warden.rb:94 (lambda)>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x0000000214bc00>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::WaitForCommunicator:0x0000000214bac0>
 INFO machine: Calling action: get_state on provider vSphere (420a0ffd-dd47-861b-9927-24f8dc7b198d)
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: machine_action_get_state #<Vagrant::Action::Builder:0x00000001190838>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::HandleBox:0x000000013af5b0>
 INFO handle_box: Machine already has box. HandleBox will not run.
DEBUG provider: Searching for cap: winrm_info
DEBUG provider: Checking in: vsphere
 INFO interface: output: Waiting for machine to boot. This may take a few minutes...
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000021653d0>
 INFO machine: Calling action: get_ssh_info on provider vSphere (420a0ffd-dd47-861b-9927-24f8dc7b198d)
 INFO interface: output: ==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Waiting for machine to boot. This may take a few minutes...
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x000000021653a8>
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: machine_action_get_ssh_info #<Vagrant::Action::Builder:0x00000002274b40>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000022ce9d8>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x000000022ce5a0>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::GetState:0x00000002165358>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::GetSshInfo:0x000000022ce2a8>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x00000002165308>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x00000002165308>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::GetState:0x00000002165358>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x000000021653a8>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000021653d0>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::HandleBox:0x000000013af5b0>
 INFO warden: Calling IN action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x000000022ce0a0>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::CloseVSphere:0x000000022ce0a0>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::GetSshInfo:0x000000022ce2a8>
 INFO warden: Calling OUT action: #<VagrantPlugins::VSphere::Action::ConnectVSphere:0x000000022ce5a0>
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000022ce9d8>
ERROR warden: Error occurred: The box is not able to report an address for WinRM to connect to yet.
WinRM cannot access this Vagrant environment. Please wait for the
Vagrant environment to be running and try again.

@pvanbuijtene
Copy link

The issue I had was because aquiring an IP took too long triggering a bug causing the timeout not to be honored. see hashicorp/vagrant#6229
I manually "fixed" it on my vagrant 1.7.4 installation because I can't get vagrant-vsphere to work with vagrant 1.8 ... and it works now :)

@dbarrett84
Copy link

+1 this in combination with the 1.8.1 fix of vagrant that @pvanbuijtene mentioned got it working for me.

Had to do manual fix on vagrant 1.7.4 installation also, as higher version of vagrant not working on windows currently because of nokogiri issue wit ruby 2.2.0.

@ghost
Copy link

ghost commented Jan 21, 2016

@michaeljb this fix is rather critical for using Vagrant with Windows guests. Can we have a new release please?

Looking into this now, sorry for the delay.

@ghost
Copy link

ghost commented Jan 21, 2016

Works for me with:

  • Vagrant 1.7.4 and Vagrant 1.8.1
  • OS X El Capitan
  • Ruby 2.0

Unfortunately I don't have a Windows machine readily available to verify the change myself there, but it sounds like it's working.

@pvanbuijtene and @dbarrett84: would either of you like to open a new issue with the 1.8 problems you're seeing?

ghost pushed a commit that referenced this pull request Jan 21, 2016
use Vagrant core API for waiting of communicator
@ghost ghost merged commit 241a5d2 into nsidc:master Jan 21, 2016
@ghost
Copy link

ghost commented Jan 21, 2016

Merged, putting together a release.

@dbarrett84
Copy link

There's a pull request already waiting to be merged for the 1.8 problems:
hashicorp/vagrant#6848

Thanks Michael, will test out the new release as soon as i can!

@ghost
Copy link

ghost commented Jan 21, 2016

Ah, great. I misunderstood, thought the 1.8 issue was related to vagrant-vsphere. Thanks!

@mkuzmin mkuzmin deleted the wait-winrm branch January 23, 2016 14:32
@cadsimula-xin
Copy link

@pvanbuijtene how did you manually fix it? I have this issue with vagrant 1.7.4 and vagrant-vsphere 1.6.0.
Thanks.

This pull request was closed.
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

Successfully merging this pull request may close these issues.

9 participants