lib/vagrant-vcenter/action.rb in vagrant-vcenter-0.2.1 vs lib/vagrant-vcenter/action.rb in vagrant-vcenter-0.3.0

- old
+ new

@@ -11,10 +11,11 @@ # This action boots the VM, assuming the VM is in a state that requires # a bootup (i.e. not saved). def self.action_boot Vagrant::Action::Builder.new.tap do |b| b.use PowerOn + b.use PrepareNFSSettings b.use Provision b.use SyncedFolders end end @@ -91,14 +92,20 @@ Vagrant::Action::Builder.new.tap do |b| b.use Call, DestroyConfirm do |env, b2| if env[:result] b2.use ConfigValidate b2.use ConnectvCenter - b2.use Call, IsRunning do |env2, b3| - # If the VM is running, must power off - b3.use action_halt if env2[:result] - b3.use Destroy + b2.use Call, IsCreated do |env2, b3| + unless env2[:result] + b3.use MessageNotCreated + next + end + b3.use Call, IsRunning do |env3, b4| + # If the VM is running, must power off + b4.use action_halt if env3[:result] + b4.use Destroy + end end else b2.use MessageWillNotDestroy end end @@ -111,10 +118,11 @@ b.use Call, IsCreated do |env, b2| unless env[:result] b2.use MessageNotCreated next end + b2.use PrepareNFSSettings b2.use Provision b2.use SyncedFolders end end end @@ -168,14 +176,14 @@ end def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate + b.use ConnectvCenter b.use Call, IsCreated do |env, b2| b2.use HandleBox unless env[:result] end - b.use ConnectvCenter b.use InventoryCheck b.use Call, IsCreated do |env, b2| b2.use BuildVM unless env[:result] end b.use action_start @@ -214,9 +222,11 @@ action_root.join('message_will_not_destroy') autoload :PowerOff, action_root.join('power_off') autoload :PowerOn, action_root.join('power_on') + autoload :PrepareNFSSettings, + action_root.join('prepare_nfs_settings') autoload :ReadSSHInfo, action_root.join('read_ssh_info') autoload :ReadState, action_root.join('read_state') autoload :Resume,