lib/vagrant-vcloud/action.rb in vagrant-vcloud-0.2.1 vs lib/vagrant-vcloud/action.rb in vagrant-vcloud-0.2.2
- old
+ new
@@ -1,10 +1,12 @@
require 'pathname'
require 'vagrant/action/builder'
module VagrantPlugins
module VCloud
+ # This module dictates the actions to be performed by Vagrant when called
+ # with a specific command
module Action
include Vagrant::Action::Builtin
# Vagrant commands
# This action boots the VM, assuming the VM is in a state that requires
@@ -67,13 +69,10 @@
b.use ConfigValidate
b.use ConnectVCloud
b.use Call, IsPaused do |env, b2|
b2.use Resume if env[:result]
end
- b.use Call, IsBridged do |env, b2|
- b2.use UnmapPortForwardings unless env[:bridged_network]
- end
b.use PowerOff
end
end
def self.action_suspend
@@ -104,9 +103,14 @@
b2.use ConfigValidate
b2.use ConnectVCloud
b2.use Call, IsRunning do |env2, b3|
# If the VM is running, must power off
b3.use action_halt if env2[:result]
+ # Check if the network is bridged
+ b3.use Call, IsBridged do |env3, b4|
+ # if it's not, delete port forwardings.
+ b4.use UnmapPortForwardings unless env3[:bridged_network]
+ end
b3.use Destroy
end
else
b2.use MessageWillNotDestroy
end