From 79c46b4ec11710c234ab7eef9d40cc4f7e136886 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 8 Jul 2011 12:04:01 -0700 Subject: [PATCH] Forward ports now uses modify pipeline --- lib/vagrant/action/vm/forward_ports.rb | 5 +++-- test/vagrant/action/vm/forward_ports_test.rb | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/action/vm/forward_ports.rb b/lib/vagrant/action/vm/forward_ports.rb index aef0449ac..136c2ff73 100644 --- a/lib/vagrant/action/vm/forward_ports.rb +++ b/lib/vagrant/action/vm/forward_ports.rb @@ -83,11 +83,12 @@ module Vagrant def call(env) @env = env - @env["config"].vm.customize do |vm| - @env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding") + proc = lambda do |vm| + env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding") forward_ports(vm) end + env["vm.modify"].call(proc) @app.call(env) end diff --git a/test/vagrant/action/vm/forward_ports_test.rb b/test/vagrant/action/vm/forward_ports_test.rb index 350113583..401a66b30 100644 --- a/test/vagrant/action/vm/forward_ports_test.rb +++ b/test/vagrant/action/vm/forward_ports_test.rb @@ -8,6 +8,7 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase @vm = mock("vm") @vm.stubs(:name).returns("foo") @env["vm"] = @vm + @env["vm.modify"] = mock("proc") end context "initializing" do @@ -123,7 +124,12 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase context "calling" do should "clear all previous ports and forward new ports" do exec_seq = sequence("exec_seq") - @env["config"].vm.expects(:customize).yields(@internal_vm).in_sequence(exec_seq) + + @env["vm.modify"].expects(:call).with() do |proc| + proc.call(@internal_vm) + true + end + @instance.expects(:forward_ports).once.in_sequence(exec_seq) @app.expects(:call).once.with(@env).in_sequence(exec_seq) @instance.call(@env)