Class: VagrantPlugins::Openstack::Action::SnapshotDelete
- Inherits:
-
AbstractAction
- Object
- AbstractAction
- VagrantPlugins::Openstack::Action::SnapshotDelete
- Defined in:
- lib/vagrant-openstack-provider/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 |
# File 'lib/vagrant-openstack-provider/action/snapshot_delete.rb', line 7 def initialize(app, _env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-openstack-provider/action/snapshot_delete.rb', line 11 def call(env) nova = env[:openstack_client].nova machine_snapshots = nova.list_snapshots(env, env[:machine].id) snapshot = machine_snapshots.find { |s| s.name == env[:snapshot_name] } unless snapshot.nil? env[:ui].info(I18n.t('vagrant.actions.vm.snapshot.deleting', name: snapshot.name)) nova.delete_snapshot(env, snapshot.id) env[:ui].info(I18n.t('vagrant.actions.vm.snapshot.deleted', name: snapshot.name)) end @app.call env end |