Get rid of more env.env calls

This commit is contained in:
Mitchell Hashimoto 2011-12-10 14:22:04 -08:00
parent 9e58e45c69
commit 697fb7eaaf
4 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,7 @@
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

@ -17,12 +17,13 @@ module Vagrant
# Add the box then reload the box collection so that it becomes # Add the box then reload the box collection so that it becomes
# aware of it. # aware of it.
env[:ui].info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name) 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[:box_collection].add(box_name, box_url)
env["boxes"].reload! env[:box_collection].reload!
# Reload the configuration for all our VMs, since this box # Reload the configuration for all our VMs, since this box
# may be used for other VMs. # may be used for other VMs.
env.env.vms.each do |name, vm| # TODO: This doesn't work properly
env[:vm].env.vms.each do |name, vm|
vm.env.reload_config! vm.env.reload_config!
end end
end end

View File

@ -31,15 +31,15 @@ module Vagrant
end end
def setup_temp_dir def setup_temp_dir
@env.ui.info I18n.t("vagrant.actions.vm.export.create_dir") @env[:ui].info I18n.t("vagrant.actions.vm.export.create_dir")
@temp_dir = @env["export.temp_dir"] = @env.env.tmp_path.join(Time.now.to_i.to_s) @temp_dir = @env["export.temp_dir"] = @env[:tmp_path].join(Time.now.to_i.to_s)
FileUtils.mkpath(@env["export.temp_dir"]) FileUtils.mkpath(@env["export.temp_dir"])
end end
def export def export
@env.ui.info I18n.t("vagrant.actions.vm.export.exporting") @env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
@env["vm"].vm.export(ovf_path) do |progress| @env["vm"].vm.export(ovf_path) do |progress|
@env.ui.report_progress(progress.percent, 100, false) @env[:ui].report_progress(progress.percent, 100, false)
end end
end end

View File

@ -62,7 +62,7 @@ module Vagrant
# Duplicate the options, set the hostpath, and set disabled on the original # Duplicate the options, set the hostpath, and set disabled on the original
# options so the ShareFolders middleware doesn't try to mount it. # options so the ShareFolders middleware doesn't try to mount it.
acc[key] = opts.dup acc[key] = opts.dup
acc[key][:hostpath] = File.expand_path(opts[:hostpath], @env.env.root_path) acc[key][:hostpath] = File.expand_path(opts[:hostpath], @env[:root_path])
opts[:disabled] = true opts[:disabled] = true
end end