In a multi-machine environment, don't download box multiple [GH-1467]

This commit is contained in:
Mitchell Hashimoto 2013-04-19 23:51:53 -06:00
parent 04d9872674
commit c29e4d6334
2 changed files with 13 additions and 5 deletions

View File

@ -15,6 +15,8 @@ BUG FIXES:
- `vagrant package --base` works again. [GH-1615]
- Box overrides specified in provider config overrides no longer
fail to detect the box. [GH-1617]
- In a multi-machine environment, a box not found won't be downloaded
multiple times. [GH-1467]
## 1.2.1 (April 17, 2013)

View File

@ -24,11 +24,17 @@ module Vagrant
"vagrant.actions.vm.check_box.not_found",
:name => box_name,
:provider => env[:machine].provider_name)
env[:action_runner].run(Vagrant::Action.action_box_add, {
:box_name => box_name,
:box_provider => env[:machine].provider_name,
:box_url => box_url
})
begin
env[:action_runner].run(Vagrant::Action.action_box_add, {
:box_name => box_name,
:box_provider => env[:machine].provider_name,
:box_url => box_url
})
rescue Errors::BoxAlreadyExists
# Just ignore this, since it means the next part will succeed!
# This can happen in a multi-threaded environment.
end
# Reload the environment and set the VM to be the new loaded VM.
env[:machine] = env[:machine].env.machine(