Add public_address provider capability

Used by vagrant-share plugin to determine local guest address for
forwarding via ngrok.
This commit is contained in:
Zak B. Elep
2019-08-16 17:55:02 +08:00
parent 760a08a6c4
commit 55abd327eb
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
module VagrantPlugins
module ProviderLibvirt
module Cap
class PublicAddress
def self.public_address(machine)
# This does not need to be a globally routable address, it
# only needs to be accessible from the machine running
# Vagrant.
ssh_info = machine.ssh_info
return nil if !ssh_info
ssh_info[:host]
end
end
end
end
end

View File

@@ -39,6 +39,11 @@ module VagrantPlugins
Cap::NicMacAddresses
end
provider_capability(:libvirt, :public_address) do
require_relative 'cap/public_address'
Cap::PublicAddress
end
# lower priority than nfs or rsync
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/170
synced_folder('9p', 4) do