From 074ea02b821a2e52ac68df5e238164274f8a6c31 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 6 Mar 2014 11:01:19 -0800 Subject: [PATCH] providers/hyperv: public_address cap --- plugins/providers/hyperv/cap/public_address.rb | 15 +++++++++++++++ plugins/providers/hyperv/plugin.rb | 5 +++++ plugins/providers/hyperv/provider.rb | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 plugins/providers/hyperv/cap/public_address.rb diff --git a/plugins/providers/hyperv/cap/public_address.rb b/plugins/providers/hyperv/cap/public_address.rb new file mode 100644 index 000000000..165742525 --- /dev/null +++ b/plugins/providers/hyperv/cap/public_address.rb @@ -0,0 +1,15 @@ +module VagrantPlugins + module Share + module Cap + class VirtualBox + def self.public_address(machine) + return nil if machine.state.id != :running + + ssh_info = machine.ssh_info + return nil if !ssh_info + ssh_info[:host] + end + end + end + end +end diff --git a/plugins/providers/hyperv/plugin.rb b/plugins/providers/hyperv/plugin.rb index 7cfea468b..889e9b3af 100644 --- a/plugins/providers/hyperv/plugin.rb +++ b/plugins/providers/hyperv/plugin.rb @@ -22,6 +22,11 @@ module VagrantPlugins Config end + provider_capability("hyperv", "public_address") do + require_relative "cap/public_address" + Cap::PublicAddress + end + protected def self.init! diff --git a/plugins/providers/hyperv/provider.rb b/plugins/providers/hyperv/provider.rb index de0453e20..145bb6266 100644 --- a/plugins/providers/hyperv/provider.rb +++ b/plugins/providers/hyperv/provider.rb @@ -77,6 +77,8 @@ module VagrantPlugins if env[:machine_ssh_info] env[:machine_ssh_info].merge!(:port => 22) end + + env[:machine_ssh_info] end end end