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)
* Reloading configuration for VMs (see check_box.rb)
* Only allow one kind of vagrantfile to be loaded (i.e. if both
Vagrantfile and vagrantfile exist, throw an error)
* 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].reload!
# Reload the configuration for all our VMs, since this box
# may be used for other VMs.
# TODO: This doesn't work properly
env[:vm].env.vms.each do |name, vm|
vm.env.reload_config!
end
# Reload the environment and set the VM to be the new loaded VM.
env[:vm].env.reload!
env[:vm] = env[:vm].env.vms[env[:vm].name]
end
@app.call(env)

View File

@ -163,7 +163,7 @@ module Vagrant
#
# @return [Array<VM>]
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
# Returns the primary VM associated with this environment. This
@ -356,9 +356,11 @@ module Vagrant
end
# Reloads the configuration of this environment.
def reload_config!
def reload!
@config = nil
@vms = nil
load_config!
load_vms!
self
end