Use a safer random name for containers (closes GH-192)
if the same vagrantfile is up'd in the same second in the same basedir this caused a conflict
This commit is contained in:
parent
7e00b96520
commit
6e7ab85dad
2 changed files with 7 additions and 1 deletions
|
@ -4,6 +4,10 @@ FEATURES:
|
|||
|
||||
- Support for naming containers from Vagrantfiles [#132](https://github.com/fgrehm/vagrant-lxc/issues/132)
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
- Use a safer random name for containers [#152](https://github.com/fgrehm/vagrant-lxc/issues/152)
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- Properly detect if lxc is installed on hosts that do not have `lxc-version` on their paths [#186](https://github.com/fgrehm/vagrant-lxc/issues/186)
|
||||
|
|
|
@ -17,7 +17,9 @@ module Vagrant
|
|||
else
|
||||
container_name = "#{env[:root_path].basename}_#{env[:machine].name}"
|
||||
container_name.gsub!(/[^-a-z0-9_]/i, "")
|
||||
container_name << "-#{Time.now.to_i}"
|
||||
# milliseconds + random number suffix to allow for simultaneous
|
||||
# `vagrant up` of the same box in different dirs
|
||||
container_name << "_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
|
||||
end
|
||||
|
||||
env[:machine].provider.driver.create(
|
||||
|
|
Loading…
Reference in a new issue