Fixed a bug with forwarded ports action
This commit is contained in:
parent
9438b3b01e
commit
cb2f1ff402
|
@ -10,10 +10,10 @@ module Vagrant
|
||||||
port.name = name
|
port.name = name
|
||||||
port.hostport = options[:hostport]
|
port.hostport = options[:hostport]
|
||||||
port.guestport = options[:guestport]
|
port.guestport = options[:guestport]
|
||||||
@vm.forwarded_ports << port
|
@vm.vm.forwarded_ports << port
|
||||||
end
|
end
|
||||||
|
|
||||||
@vm.save(true)
|
@vm.vm.save(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -99,7 +99,7 @@ error
|
||||||
end
|
end
|
||||||
|
|
||||||
# Export and package the current vm
|
# Export and package the current vm
|
||||||
#
|
#
|
||||||
# This command requires that an instance be powered off
|
# This command requires that an instance be powered off
|
||||||
def package(name=nil)
|
def package(name=nil)
|
||||||
Env.load!
|
Env.load!
|
||||||
|
|
|
@ -5,6 +5,13 @@ module Vagrant
|
||||||
attr_reader :actions
|
attr_reader :actions
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
# Executes a specific action
|
||||||
|
def execute!(action_klass)
|
||||||
|
vm = new
|
||||||
|
vm.actions << action_klass
|
||||||
|
vm.execute!
|
||||||
|
end
|
||||||
|
|
||||||
# Bring up the virtual machine. Imports the base image and
|
# Bring up the virtual machine. Imports the base image and
|
||||||
# provisions it.
|
# provisions it.
|
||||||
def up
|
def up
|
||||||
|
|
|
@ -18,8 +18,8 @@ class ForwardPortsActionTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@mock_vm.expects(:forwarded_ports).returns(forwarded_ports)
|
@vm.expects(:forwarded_ports).returns(forwarded_ports)
|
||||||
@mock_vm.expects(:save).with(true).once
|
@vm.expects(:save).with(true).once
|
||||||
@action.execute!
|
@action.execute!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,6 +87,18 @@ class VMTest < Test::Unit::TestCase
|
||||||
|
|
||||||
@vm.execute!
|
@vm.execute!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "run actions on class method execute!" do
|
||||||
|
vm = mock("vm")
|
||||||
|
actions = mock("actions")
|
||||||
|
execute_seq = sequence("execute_seq")
|
||||||
|
Vagrant::VM.expects(:new).returns(vm).in_sequence(execute_seq)
|
||||||
|
vm.expects(:actions).returns(actions).in_sequence(execute_seq)
|
||||||
|
actions.expects(:<<).with("foo").once.in_sequence(execute_seq)
|
||||||
|
vm.expects(:execute!).once.in_sequence(execute_seq)
|
||||||
|
|
||||||
|
Vagrant::VM.execute!("foo")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "vagrant up" do
|
context "vagrant up" do
|
||||||
|
|
Loading…
Reference in New Issue