Merge pull request #1036 from zakame/public_address-provider-capability

Add public_address provider capability
This commit is contained in:
Darragh Bailey 2020-06-04 15:15:39 +01:00 committed by GitHub
commit f1b0c9a460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 Cap::NicMacAddresses
end end
provider_capability(:libvirt, :public_address) do
require_relative 'cap/public_address'
Cap::PublicAddress
end
# lower priority than nfs or rsync # lower priority than nfs or rsync
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/170 # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/170
synced_folder('9p', 4) do synced_folder('9p', 4) do