lib/vagrant-ovirt4/action.rb in vagrant-ovirt4-1.2.2 vs lib/vagrant-ovirt4/action.rb in vagrant-ovirt4-1.2.3

- old
+ new

@@ -7,10 +7,11 @@ include Vagrant::Action::Builtin # This action is called to bring the box up from nothing. def self.action_up Vagrant::Action::Builder.new.tap do |b| + b.use HandleBox b.use ConfigValidate b.use ConnectOVirt b.use Call, ReadState do |env, b2| if env[:machine_state_id] == :up b2.use SyncFolders @@ -24,11 +25,11 @@ end if env[:machine_state_id] == :not_created b2.use SetNameOfDomain b2.use CreateVM - #b2.use ResizeDisk + b2.use ResizeDisk b2.use Provision b2.use CreateNetworkInterfaces b2.use SetHostname @@ -36,10 +37,11 @@ b2.use StartVM b2.use WaitTillUp b2.use SyncFolders end + b.use DisconnectOVirt end end def self.action_destroy Vagrant::Action::Builder.new.tap do |b| @@ -53,10 +55,11 @@ b2.use ConnectOVirt b2.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup) b2.use HaltVM b2.use WaitTillDown b2.use DestroyVM + b2.use DisconnectOVirt end end end def self.action_provision @@ -75,13 +78,15 @@ # This action is called to read the state of the machine. The resulting # state is expected to be put into the `:machine_state_id` key. def self.action_read_state Vagrant::Action::Builder.new.tap do |b| + b.use HandleBox b.use ConfigValidate b.use ConnectOVirt b.use ReadState + b.use DisconnectOVirt end end # This action is called to read the SSH info of the machine. The # resulting state is expected to be put into the `:machine_ssh_info` @@ -89,10 +94,11 @@ def self.action_read_ssh_info Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectOVirt b.use ReadSSHInfo + b.use DisconnectOVirt end end def self.action_ssh Vagrant::Action::Builder.new.tap do |b| @@ -109,10 +115,11 @@ end raise Errors::NoIPError if env[:ip_address].nil? b2.use SSHExec end + b.use DisconnectOVirt end end def self.action_ssh_run Vagrant::Action::Builder.new.tap do |b| @@ -129,10 +136,11 @@ end raise Errors::NoIPError if env[:ip_address].nil? b2.use SSHRun end + b.use DisconnectOVirt end end def self.action_halt @@ -208,18 +216,20 @@ end end action_root = Pathname.new(File.expand_path("../action", __FILE__)) autoload :ConnectOVirt, action_root.join("connect_ovirt") + autoload :DisconnectOVirt, action_root.join("disconnect_ovirt") autoload :CreateNetworkInterfaces, action_root.join("create_network_interfaces") autoload :CreateVM, action_root.join("create_vm") autoload :DestroyVM, action_root.join("destroy_vm") autoload :HaltVM, action_root.join("halt_vm") autoload :IsCreated, action_root.join("is_created") autoload :IsRunning, action_root.join("is_running") autoload :ReadSSHInfo, action_root.join("read_ssh_info") autoload :ReadState, action_root.join("read_state") + autoload :ResizeDisk, action_root.join("resize_disk") autoload :SetNameOfDomain, action_root.join("set_name_of_domain") autoload :SnapshotDelete, action_root.join("snapshot_delete") autoload :SnapshotList, action_root.join("snapshot_list") autoload :SnapshotSave, action_root.join("snapshot_save") autoload :StartVM, action_root.join("start_vm") @@ -246,9 +256,10 @@ b2.use MessageNotCreated next end yield env, b2 end + b.use DisconnectOVirt end end end end end