Skip to content

Commit

Permalink
Merge pull request #162 from mkuzmin/wait-winrm
Browse files Browse the repository at this point in the history
use Vagrant core API for waiting of communicator
  • Loading branch information
michaeljb committed Jan 21, 2016
2 parents 7cd0455 + a6e55bc commit 241a5d2
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Metrics/MethodLength:
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 161
Max: 162

# Offense count: 3
Metrics/PerceivedComplexity:
Expand Down
1 change: 1 addition & 0 deletions lib/vSphere/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def self.action_up
b2.use PowerOn unless env[:result]
end
b.use CloseVSphere
b.use WaitForCommunicator
b.use Provision
b.use SyncedFolders
b.use SetHostname
Expand Down
5 changes: 0 additions & 5 deletions lib/vSphere/action/clone.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
require 'rbvmomi'
require 'i18n'
require 'vSphere/util/vim_helpers'
require 'vSphere/util/machine_helpers'

module VagrantPlugins
module VSphere
module Action
class Clone
include Util::VimHelpers
include Util::MachineHelpers

def initialize(app, _env)
@app = app
Expand Down Expand Up @@ -92,9 +90,6 @@ def call(env)

machine.id = new_vm.config.uuid

# wait for SSH to be available
wait_for_ssh env

env[:ui].info I18n.t('vsphere.vm_clone_success')

@app.call env
Expand Down
4 changes: 0 additions & 4 deletions lib/vSphere/action/is_running.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
require 'vSphere/util/machine_helpers'

module VagrantPlugins
module VSphere
module Action
class IsRunning
include Util::MachineHelpers

def initialize(app, _env)
@app = app
end
Expand Down
5 changes: 0 additions & 5 deletions lib/vSphere/action/power_on.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'rbvmomi'
require 'i18n'
require 'vSphere/util/vim_helpers'
require 'vSphere/util/machine_helpers'
require 'vSphere/util/vm_helpers'

module VagrantPlugins
Expand All @@ -10,7 +9,6 @@ module Action
class PowerOn
include Util::VimHelpers
include Util::VmHelpers
include Util::MachineHelpers

def initialize(app, _env)
@app = app
Expand All @@ -22,9 +20,6 @@ def call(env)
env[:ui].info I18n.t('vsphere.power_on_vm')
power_on_vm(vm)

# wait for SSH to be available
wait_for_ssh env

@app.call env
end
end
Expand Down
20 changes: 0 additions & 20 deletions lib/vSphere/util/machine_helpers.rb

This file was deleted.

6 changes: 1 addition & 5 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ en:
requesting_sdrs_recommendation: |-
Calling vSphere RecommendDatastores with StoragePlacementSpec of the following settings:
vm_clone_success: |-
New virtual machine successfully cloned and started
New virtual machine successfully cloned
destroy_vm: |-
Calling vSphere Destroy
power_off_vm: |-
Expand All @@ -20,10 +20,6 @@ en:
The VM has not been created
vm_not_running: |-
The VM is not running
waiting_for_ssh: |-
Waiting for SSH to become available...
waiting_for_winrm: |-
Waiting for WinRM to become available...
errors:
missing_template: |-
Expand Down
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def call
hostname: nil,
communicator: nil,
networks: [[:private_network, { ip: '0.0.0.0' }]],
boot_timeout: 1,
graceful_halt_timeout: 0.1),
validate: []
)
Expand All @@ -76,7 +77,7 @@ def call
:provider_config => provider_config,
:config => vm_config,
:state => double('state', id: nil),
:communicate => double('communicator', :ready? => true),
:communicate => double('communicator', :wait_for_ready => true, :ready? => true),
:ssh_info => {},
:data_dir => Pathname.new(''),
:id => nil,
Expand Down

0 comments on commit 241a5d2

Please sign in to comment.