core: Introduce a public_address capability so that we can use vagrant share
This commit is contained in:
parent
8f1b54395e
commit
056e47d364
2 changed files with 24 additions and 0 deletions
|
@ -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
|
||||||
|
|
17
lib/vagrant-lxc/provider/cap/public_address.rb
Normal file
17
lib/vagrant-lxc/provider/cap/public_address.rb
Normal 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
|
Loading…
Reference in a new issue