From a53156e426314588f7bbf41ec15174280e7edfb7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 11 Aug 2014 09:21:31 -0700 Subject: [PATCH] core: don't allow '/' in VM name [GH-4289] --- plugins/kernel_v2/config/vm.rb | 2 +- test/unit/plugins/kernel_v2/config/vm_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index d12a11891..7852b39f2 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -662,7 +662,7 @@ module VagrantPlugins # Validate sub-VMs if there are any @__defined_vms.each do |name, _| - if name =~ /[\[\]\{\}]/ + if name =~ /[\[\]\{\}\/]/ errors["vm"] << I18n.t( "vagrant.config.vm.name_invalid", name: name) diff --git a/test/unit/plugins/kernel_v2/config/vm_test.rb b/test/unit/plugins/kernel_v2/config/vm_test.rb index 6b24ac47b..c9296a28f 100644 --- a/test/unit/plugins/kernel_v2/config/vm_test.rb +++ b/test/unit/plugins/kernel_v2/config/vm_test.rb @@ -132,6 +132,7 @@ describe VagrantPlugins::Kernel_V2::VMConfig do [ "foo [1]", "bar {2}", + "foo/bar", ].each do |name| it "should disallow names with brackets" do subject.define name