From 514193090ad081e0638768f33d7e95e3ca52497f Mon Sep 17 00:00:00 2001 From: David O'Rourke Date: Fri, 3 Jun 2016 15:19:03 +0100 Subject: [PATCH 1/2] prepare_nfs_settings: Add scoped hash override test. --- .../virtualbox/action/prepare_nfs_settings_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb index c358f6720..d4eaf654c 100644 --- a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +++ b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb @@ -125,5 +125,14 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do expect(env[:nfs_host_ip]).to eq("1.2.3.4") expect(env[:nfs_machine_ip]).to eq(["11.12.13.14", "2.3.4.5"]) end + + it "allows the use of scoped hash overrides as options" do + env[:machine].config.vm.network :private_network, virtualbox__ip: "11.12.13.14" + + subject.call(env) + + expect(env[:nfs_host_ip]).to eq("1.2.3.4") + expect(env[:nfs_machine_ip]).to eq(["11.12.13.14", "2.3.4.5"]) + end end end From 60fd777806527bb4601819cb733edc2087bce481 Mon Sep 17 00:00:00 2001 From: David O'Rourke Date: Fri, 3 Jun 2016 15:19:23 +0100 Subject: [PATCH 2/2] prepare_nfs_settings: Use scoped hash override when reading static IPs. --- plugins/providers/virtualbox/action/prepare_nfs_settings.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb index 2ee5e9c54..c8f6ee436 100644 --- a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +++ b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb @@ -90,6 +90,8 @@ module VagrantPlugins def read_static_machine_ips ips = [] @machine.config.vm.networks.each do |type, options| + options = scoped_hash_override(options, :virtualbox) + if type == :private_network && options[:type] != :dhcp && options[:ip].is_a?(String) ips << options[:ip] end