Sha256: 2550c99743741c49839ebffb08627f4383756359f15d79580be96e89523bd911

Contents?: true

Size: 1.06 KB

Versions: 25

Compression:

Stored size: 1.06 KB

Contents

module Fission
  class Command
    class SnapshotList < Command

      def initialize(args=[])
        super
      end

      def execute
        unless @args.count == 1
          Fission.ui.output self.class.help
          Fission.ui.output ""
          Fission.ui.output_and_exit "Incorrect arguments for snapshot list command", 1
        end

        vm_name = @args.first

        vm = Fission::VM.new vm_name

        unless vm.exists? 
          Fission.ui.output_and_exit "Unable to find the VM #{vm_name} (#{vm.path})", 1 
        end

        snaps=vm.snapshots
        unless snaps.empty?
            Fission.ui.output snaps.join("\n")
        else
          Fission.ui.output "No snapshots found for VM '#{vm_name}'"
        end

        # TODO
        Fission.ui.output_and_exit "There was an error listing the snapshots.  The error was:\n#{task.output}", task.code
      end

      def option_parser
        optparse = OptionParser.new do |opts|
          opts.banner = "\nsnapshot list: fission snapshot list my_vm"
        end

        optparse
      end

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
veewee-0.3.0.alpha5 lib/fission/command/snapshot_list.rb
veewee-0.3.0.alpha4 lib/fission/command/snapshot_list.rb
veewee-0.3.0.alpha3 lib/fission/command/snapshot_list.rb
veewee-0.3.0.alpha2 lib/fission/command/snapshot_list.rb
veewee-0.3.0.alpha1 lib/fission/command/snapshot_list.rb