Class: Fission::Command::SnapshotList
- Inherits:
-
Fission::Command
- Object
- Fission::Command
- Fission::Command::SnapshotList
- Defined in:
- lib/fission.old/command/snapshot_list.rb
Instance Attribute Summary
Attributes inherited from Fission::Command
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args = []) ⇒ SnapshotList
constructor
A new instance of SnapshotList.
- #option_parser ⇒ Object
Methods inherited from Fission::Command
Constructor Details
#initialize(args = []) ⇒ SnapshotList
Returns a new instance of SnapshotList.
5 6 7 |
# File 'lib/fission.old/command/snapshot_list.rb', line 5 def initialize(args=[]) super end |
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fission.old/command/snapshot_list.rb', line 9 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 |
#option_parser ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/fission.old/command/snapshot_list.rb', line 35 def option_parser optparse = OptionParser.new do |opts| opts. = "\nsnapshot list: fission snapshot list my_vm" end optparse end |