From 602505a1365368b1a1a3f06327de9a97cc23eaad Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 25 Nov 2013 11:25:10 -0800 Subject: [PATCH] providers/virtualbox: some validation around internal networks --- plugins/providers/virtualbox/config.rb | 8 ++++++++ templates/locales/en.yml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/plugins/providers/virtualbox/config.rb b/plugins/providers/virtualbox/config.rb index d7d3b2269..0aa9bde1d 100644 --- a/plugins/providers/virtualbox/config.rb +++ b/plugins/providers/virtualbox/config.rb @@ -120,6 +120,14 @@ module VagrantPlugins end end + # Verify that internal networks are only on private networks. + machine.config.vm.networks.each do |type, data| + if data[:virtualbox__intnet] && type != :private_network + errors << I18n.t("vagrant.virtualbox.config.intnet_on_bad_type") + break + end + end + { "VirtualBox Provider" => errors } end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 0348d4ddc..c22812f43 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -61,6 +61,8 @@ en: config: id_in_pre_import: |- The ':id' parameter is not available in "pre-import" customizations. + intnet_on_bad_type: |- + VirtualBox internal networks can only be enabled on "private_networks" invalid_event: |- %{event} is not a valid event for customization. Valid events are: %{valid_events}