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