core: Introduce a public_address capability so that we can use vagrant share

This commit is contained in:
Fabio Rehm 2014-03-12 10:27:30 -03:00
parent 8f1b54395e
commit 056e47d364
2 changed files with 24 additions and 0 deletions

View file

@ -30,6 +30,13 @@ module Vagrant
SyncedFolder SyncedFolder
end end
end end
if Vagrant::Backports.vagrant_1_5_or_later?
provider_capability("lxc", "public_address") do
require_relative "provider/cap/public_address"
Provider::Cap::PublicAddress
end
end
end end
end end
end end

View file

@ -0,0 +1,17 @@
module Vagrant
module LXC
class Provider
module Cap
module PublicAddress
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
end