providers/hyperv: fix file format to unix

This commit is contained in:
Mitchell Hashimoto 2014-02-26 12:07:18 -08:00
parent ea871ec9ef
commit 31abc3f4a3
1 changed files with 45 additions and 45 deletions

View File

@ -1,45 +1,45 @@
require "timeout" require "timeout"
module VagrantPlugins module VagrantPlugins
module HyperV module HyperV
module Action module Action
class WaitForIPAddress class WaitForIPAddress
def initialize(app, env) def initialize(app, env)
@app = app @app = app
end end
def call(env) def call(env)
timeout = env[:machine].provider_config.ip_address_timeout timeout = env[:machine].provider_config.ip_address_timeout
env[:ui].output("Waiting for the machine to report its IP address...") env[:ui].output("Waiting for the machine to report its IP address...")
env[:ui].detail("Timeout: #{timeout} seconds") env[:ui].detail("Timeout: #{timeout} seconds")
guest_ip = nil guest_ip = nil
Timeout.timeout(timeout) do Timeout.timeout(timeout) do
while true while true
# If a ctrl-c came through, break out # If a ctrl-c came through, break out
return if env[:interrupted] return if env[:interrupted]
# Try to get the IP # Try to get the IP
network_info = env[:machine].provider.driver.execute( network_info = env[:machine].provider.driver.execute(
"get_network_config.ps1", VmId: env[:machine].id) "get_network_config.ps1", VmId: env[:machine].id)
guest_ip = network_info["ip"] guest_ip = network_info["ip"]
break if guest_ip && guest_ip != "" break if guest_ip && guest_ip != ""
sleep 1 sleep 1
end end
end end
# If we were interrupted then return now # If we were interrupted then return now
return if env[:interrupted] return if env[:interrupted]
env[:ui].detail("IP: #{guest_ip}") env[:ui].detail("IP: #{guest_ip}")
@app.call(env) @app.call(env)
rescue Timeout::Error rescue Timeout::Error
raise Errors::IPAddrTimeout raise Errors::IPAddrTimeout
end end
end end
end end
end end
end end