Merge pull request #2482 from andyfowler/safer-vbox-names
core: safer default VM names for Virtualbox
This commit is contained in:
commit
504707f96a
|
@ -23,7 +23,8 @@ module VagrantPlugins
|
||||||
if !name
|
if !name
|
||||||
prefix = "#{env[:root_path].basename.to_s}_#{env[:machine].name}"
|
prefix = "#{env[:root_path].basename.to_s}_#{env[:machine].name}"
|
||||||
prefix.gsub!(/[^-a-z0-9_]/i, "")
|
prefix.gsub!(/[^-a-z0-9_]/i, "")
|
||||||
name = prefix + "_#{Time.now.to_i}"
|
# milliseconds + random number suffix to allow for simultaneous `vagrant up` of the same box in different dirs
|
||||||
|
name = prefix + "_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Verify the name is not taken
|
# Verify the name is not taken
|
||||||
|
|
Loading…
Reference in New Issue