Sha256: 53b0639069e8a009e8ece4bc8dd9ef73408025b850ff9a7f67484dc141a5314c

Contents?: true

Size: 1.31 KB

Versions: 54

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module VagrantPlugins
  module ProviderZone
    module Command
      # This is used to list snapshots for the zone
      class ListSnapshots < Vagrant.plugin('2', :command)
        def execute
          options = {}
          opts = OptionParser.new do |o|
            o.banner = 'Usage: vagrant zone zfssnapshot list [options]'
            o.on('--dataset SNAPSHOTPATH', '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 <= 2
            @env.ui.info(opts.help)
            return
          end

          if options[:snapshot_name].nil?
            t = Time.new
            dash = '-'
            colon = ':'
            datetime = t.year.to_s + dash + t.month.to_s + dash + t.day.to_s + dash + t.hour.to_s + colon + t.min.to_s + colon + t.sec.to_s
            options[:snapshot_name] = datetime
          end

          with_target_vms(argv, provider: :zone) do |machine|
            driver = machine.provider.driver
            driver.zfs(@env.ui, 'list', options)
          end
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
vagrant-zones-0.1.55 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.54 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.52 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.48 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.46 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.44 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.12 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.10 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.9 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.8 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.41 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.1.3 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.0.12 lib/vagrant-zones/command/list_snapshots.rb
vagrant-zones-0.0.1 lib/vagrant-zones/command/list_snapshots.rb