providers/hyperv: ssh_info doesn't need a dedicated action stack
This commit is contained in:
parent
c8e02ddd78
commit
cf5528b813
|
@ -161,14 +161,6 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.action_read_guest_ip
|
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
|
||||||
b.use ConfigValidate
|
|
||||||
b.use ReadGuestIP
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
# The autoload farm
|
# The autoload farm
|
||||||
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
||||||
autoload :DeleteVM, action_root.join("delete_vm")
|
autoload :DeleteVM, action_root.join("delete_vm")
|
||||||
|
@ -179,7 +171,6 @@ module VagrantPlugins
|
||||||
autoload :StartInstance, action_root.join('start_instance')
|
autoload :StartInstance, action_root.join('start_instance')
|
||||||
autoload :StopInstance, action_root.join('stop_instance')
|
autoload :StopInstance, action_root.join('stop_instance')
|
||||||
autoload :SuspendVM, action_root.join("suspend_vm")
|
autoload :SuspendVM, action_root.join("suspend_vm")
|
||||||
autoload :ReadGuestIP, action_root.join('read_guest_ip')
|
|
||||||
autoload :WaitForIPAddress, action_root.join("wait_for_ip_address")
|
autoload :WaitForIPAddress, action_root.join("wait_for_ip_address")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -70,15 +70,17 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def ssh_info
|
def ssh_info
|
||||||
# Run a custom action called "read_guest_ip" which does what it
|
# We can only SSH into a running machine
|
||||||
# says and puts the resulting SSH info into the `:machine_ssh_info`
|
return nil if state.id != :running
|
||||||
# key in the environment.
|
|
||||||
env = @machine.action("read_guest_ip")
|
|
||||||
if env[:machine_ssh_info]
|
|
||||||
env[:machine_ssh_info].merge!(:port => 22)
|
|
||||||
end
|
|
||||||
|
|
||||||
env[:machine_ssh_info]
|
# Read the IP of the machine using Hyper-V APIs
|
||||||
|
network = @driver.read_guest_ip
|
||||||
|
return nil if !network["ip"]
|
||||||
|
|
||||||
|
{
|
||||||
|
host: network["ip"],
|
||||||
|
port: 22,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue