Reload the configuration for all VMs after downloading a box. Fixes GH-564
This commit is contained in:
parent
bac87f2478
commit
5d684b9001
|
@ -14,10 +14,17 @@ module Vagrant
|
|||
box_url = env["config"].vm.box_url
|
||||
raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url
|
||||
|
||||
# Add the box then reload the box collection so that it becomes
|
||||
# aware of it.
|
||||
env.ui.info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name)
|
||||
Vagrant::Box.add(env.env, box_name, box_url)
|
||||
env["boxes"].reload!
|
||||
env.env.reload_config!
|
||||
|
||||
# Reload the configuration for all our VMs, since this box
|
||||
# may be used for other VMs.
|
||||
env.env.vms.each do |name, vm|
|
||||
vm.env.reload_config!
|
||||
end
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
|
|
@ -66,7 +66,7 @@ module Acceptance
|
|||
# This checks that the "up" output properly contains text showing that
|
||||
# it is downloading the box during the up process.
|
||||
def up_fetching_box(name, vm=DEFAULT_VM)
|
||||
@text =~ /^[#{vm}] Box #{name} was not found. Fetching box from specified URL...$/
|
||||
@text =~ /^\[#{vm}\] Box #{name} was not found. Fetching box from specified URL...$/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,12 +40,17 @@ class CheckBoxVMActionTest < Test::Unit::TestCase
|
|||
config.vm.box_url = "http://google.com"
|
||||
vf
|
||||
|
||||
# Save this for later because the expecations below clobber it
|
||||
vms = env.env.vms
|
||||
|
||||
instance = @klass.new(app, env)
|
||||
seq = sequence("seq")
|
||||
env.env.boxes.expects(:find).returns(nil)
|
||||
Vagrant::Box.expects(:add).with(env.env, env["config"].vm.box, env["config"].vm.box_url).in_sequence(seq)
|
||||
env.env.boxes.expects(:reload!).in_sequence(seq)
|
||||
env.env.expects(:reload_config!).in_sequence(seq)
|
||||
vms.each do |name, vm|
|
||||
vm.env.expects(:reload_config!).in_sequence(seq)
|
||||
end
|
||||
app.expects(:call).with(env).once.in_sequence(seq)
|
||||
|
||||
assert_nothing_raised {
|
||||
|
|
Loading…
Reference in New Issue