Sha256: 695945b8fcbb29a55cd5bc6cb33aa112a0641cd009cd2351232b3783077e119b

Contents?: true

Size: 1.14 KB

Versions: 54

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module VagrantPlugins
  module ProviderZone
    module Command
      # This is used to delete zfs snapshots the zone
      class DeleteSnapshots < Vagrant.plugin('2', :command)
        def execute
          options = {}
          opts = OptionParser.new do |o|
            o.banner = 'Usage: vagrant zone zfssnapshot list [options]'
            o.on('--dataset DATASETPATH', 'Specify snapshot path') do |p|
              options[:dataset] = p
            end
            o.on('--snapshot_name @SNAPSHOTNAME', 'Specify snapshot name') do |p|
              options[:snapshot_name] = p
            end
          end

          argv = parse_options(opts)
          return unless argv

          unless argv.length <= 4
            @env.ui.info(opts.help)
            return
          end

          options[:dataset] = 'all' if options[:dataset].nil?
          options[:snapshot_name] = 'all' if options[:snapshot_name].nil?
          with_target_vms(argv, provider: :zone) do |machine|
            driver = machine.provider.driver
            driver.zfs(@env.ui, 'destroy', options)
          end
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
vagrant-zones-0.1.98 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.97 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.96 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.94 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.93 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.92 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.91 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.90 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.89 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.88 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.87 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.86 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.85 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.84 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.83 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.82 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.81 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.80 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.79 lib/vagrant-zones/command/delete_snapshots.rb
vagrant-zones-0.1.78 lib/vagrant-zones/command/delete_snapshots.rb