Sha256: 31347256ad8c8d78ce5b85475d3a466925cef1104e920cf36d965ac16823e387
Contents?: true
Size: 798 Bytes
Versions: 3
Compression:
Stored size: 798 Bytes
Contents
require 'vagrant-conoha/action/abstract_action' module VagrantPlugins module ConoHa module Action class SnapshotCleanup < AbstractAction def initialize(app, _env) @app = app end def call(env) nova = env[:openstack_client].nova machine_snapshots = nova.list_snapshots(env, env[:machine].id) snapshots_to_clean = machine_snapshots.select do |s| s.metadata.key?('vagrant_snapshot') end @app.call env unless snapshots_to_clean.empty? env[:ui].info("Deleting Vagrant snapshots: #{snapshots_to_clean.map(&:name)}") end snapshots_to_clean.each do |s| nova.delete_snapshot(env, s.id) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems