Environment reloading works

This commit is contained in:
Mitchell Hashimoto 2011-12-10 16:07:28 -08:00
parent a1d3f8b4dd
commit 40b9254d5a
3 changed files with 7 additions and 10 deletions

View File

@ -1,7 +1,5 @@
This is a TODO file for only this branch (config-overhaul) This is a TODO file for only this branch (config-overhaul)
* Reloading configuration for VMs (see check_box.rb)
* Only allow one kind of vagrantfile to be loaded (i.e. if both * Only allow one kind of vagrantfile to be loaded (i.e. if both
Vagrantfile and vagrantfile exist, throw an error) Vagrantfile and vagrantfile exist, throw an error)
* Nicer error if can't setup home directory * Nicer error if can't setup home directory

View File

@ -20,12 +20,9 @@ module Vagrant
env[:box_collection].add(box_name, box_url) env[:box_collection].add(box_name, box_url)
env[:box_collection].reload! env[:box_collection].reload!
# Reload the configuration for all our VMs, since this box # Reload the environment and set the VM to be the new loaded VM.
# may be used for other VMs. env[:vm].env.reload!
# TODO: This doesn't work properly env[:vm] = env[:vm].env.vms[env[:vm].name]
env[:vm].env.vms.each do |name, vm|
vm.env.reload_config!
end
end end
@app.call(env) @app.call(env)

View File

@ -163,7 +163,7 @@ module Vagrant
# #
# @return [Array<VM>] # @return [Array<VM>]
def vms_ordered def vms_ordered
@vms_enum ||= config.vm.defined_vm_keys.map { |name| @vms[name] } @vms_enum ||= config.global.vm.defined_vm_keys.map { |name| @vms[name] }
end end
# Returns the primary VM associated with this environment. This # Returns the primary VM associated with this environment. This
@ -356,9 +356,11 @@ module Vagrant
end end
# Reloads the configuration of this environment. # Reloads the configuration of this environment.
def reload_config! def reload!
@config = nil @config = nil
@vms = nil
load_config! load_config!
load_vms!
self self
end end