core: don't allow '/' in VM name [GH-4289]

This commit is contained in:
Mitchell Hashimoto 2014-08-11 09:21:31 -07:00
parent b675be383b
commit a53156e426
2 changed files with 2 additions and 1 deletions

View File

@ -662,7 +662,7 @@ module VagrantPlugins
# Validate sub-VMs if there are any # Validate sub-VMs if there are any
@__defined_vms.each do |name, _| @__defined_vms.each do |name, _|
if name =~ /[\[\]\{\}]/ if name =~ /[\[\]\{\}\/]/
errors["vm"] << I18n.t( errors["vm"] << I18n.t(
"vagrant.config.vm.name_invalid", "vagrant.config.vm.name_invalid",
name: name) name: name)

View File

@ -132,6 +132,7 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
[ [
"foo [1]", "foo [1]",
"bar {2}", "bar {2}",
"foo/bar",
].each do |name| ].each do |name|
it "should disallow names with brackets" do it "should disallow names with brackets" do
subject.define name subject.define name