The following Vagrantfile defines several instances of the same "base networking" provider:
Vagrant.configure('2') do |config|
# Global Provider configuration.
config.vm.provider('virtualbox') do |p, c|
c.vm.provision('base networking', type: hosts) do |hosts|
hosts.exports[:foo] += ['@vagrant_private_networks', ['@vagrant_hostnames']]
end
end
config.vm.provider('vsphere') do |p, c|
c.vm.provision('base networking', type: hosts) do |hosts|
hosts.exports[:foo] += ['@facter_ipaddress', ['@vagrant_hostnames']]
end
end
config.vm.define('proxy') do |vm|
# Local VM alias
config.vm.provider('virtualbox') do |p, c|
c.vm.provision('base networking', type: hosts) do |hosts|
hosts.exports[:foo] += ['@vagrant_private_networks', ['some-alias']]
end
end
end
end
These should all merge together for the proxy VM to create an array of exports containing records for both the hostnames and some-alias. However, the merge method for the hosts provisioner configuration only merges the hosts attribute:
Config Builder also has a variation on this issue: it just overwrites the exports attribute each time a new block appears instead of merging values together in a configure_exports method like:
The following Vagrantfile defines several instances of the same
"base networking"
provider:These should all merge together for the
proxy
VM to create an array of exports containing records for both the hostnames andsome-alias
. However, themerge
method for thehosts
provisioner configuration only merges thehosts
attribute:https://github.com/oscar-stack/vagrant-hosts/blob/2.8.1/lib/vagrant-hosts/config.rb#L86-L93
Config Builder also has a variation on this issue: it just overwrites the
exports
attribute each time a new block appears instead of merging values together in aconfigure_exports
method like:https://github.com/oscar-stack/vagrant-hosts/blob/2.8.1/lib/vagrant-hosts/config_builder/1_x.rb#L23-L28