`vagrant reload` uses new Environment

This commit is contained in:
Mitchell Hashimoto 2010-03-19 16:50:54 -07:00
parent b461e0ee8b
commit e68994556c
4 changed files with 14 additions and 7 deletions

View File

@ -5,7 +5,7 @@ module Vagrant
def prepare
steps = [Customize, ForwardPorts, SharedFolders, Boot]
steps.unshift(Halt) if @runner.vm.running?
steps << Provision if !Vagrant.config.vm.provisioner.nil?
steps << Provision if !@runner.env.config.vm.provisioner.nil?
steps.each do |action_klass|
@runner.add_action(action_klass)

View File

@ -101,9 +101,9 @@ msg
# VM, updates the metadata (shared folders, forwarded ports), restarts
# the VM, and then reruns the provisioning if enabled.
def reload
Env.load!
Env.require_persisted_vm
Env.persisted_vm.execute!(Actions::VM::Reload)
env = Environment.load!
env.require_persisted_vm
env.vm.execute!(Actions::VM::Reload)
end
# SSH into the vagrant instance. This will setup an SSH connection into

View File

@ -32,11 +32,13 @@ class ReloadActionTest < Test::Unit::TestCase
end
should "add in the provisioning step if enabled" do
mock_config do |config|
env = mock_environment do |config|
# Dummy provisioner to test
config.vm.provisioner = "foo"
end
@runner.stubs(:env).returns(env)
@default_order.push(Vagrant::Actions::VM::Provision)
setup_action_expectations
@action.prepare

View File

@ -107,8 +107,13 @@ class CommandsTest < Test::Unit::TestCase
end
context "reload" do
should "load the current environment" do
Vagrant::Environment.expects(:load!).once.returns(@env)
Vagrant::Commands.reload
end
should "require a persisted VM" do
Vagrant::Env.expects(:require_persisted_vm).once
@env.expects(:require_persisted_vm).once
Vagrant::Commands.reload
end