Class: VagrantPlugins::OVirtProvider::Action::SnapshotDelete
- Inherits:
-
Object
- Object
- VagrantPlugins::OVirtProvider::Action::SnapshotDelete
- Defined in:
- lib/vagrant-ovirt4/action/snapshot_delete.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ SnapshotDelete
constructor
A new instance of SnapshotDelete.
Constructor Details
#initialize(app, env) ⇒ SnapshotDelete
Returns a new instance of SnapshotDelete.
7 8 9 10 |
# File 'lib/vagrant-ovirt4/action/snapshot_delete.rb', line 7 def initialize(app, env) @logger = Log4r::Logger.new("vagrant_ovirt4::action::snapshot_delete") @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vagrant-ovirt4/action/snapshot_delete.rb', line 12 def call(env) env[:ui].info(I18n.t("vagrant_ovirt4.snapshot_delete")) snapshots_service = env[:vms_service].vm_service(env[:machine].id).snapshots_service snapshot = snapshots_service.snapshot_service(env[:snapshot_name]) begin raise RemoveActiveSnapshotError, :id => env[:snapshot_name] if snapshot.get.snapshot_type == 'active' snapshot.remove rescue OvirtSDK4::Error => e fault_detail = /Fault detail is \"\[(.*)\]\".*/.match(e.) = e. = fault_detail[1] unless fault_detail.nil? raise Errors::RemoveSnapshotError, :id => env[:snapshot_name], :error_message => end @app.call(env) end |