Class: Fission::Command::SnapshotDelete
- Inherits:
-
Fission::Command
- Object
- Fission::Command
- Fission::Command::SnapshotDelete
- Defined in:
- lib/fission/command/snapshot_delete.rb
Instance Attribute Summary
Attributes inherited from Fission::Command
Instance Method Summary collapse
Methods inherited from Fission::Command
#command_name, help, #initialize, #ui
Methods included from Fission::CommandHelpers
#incorrect_arguments, #parse_arguments
Constructor Details
This class inherits a constructor from Fission::Command
Instance Method Details
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fission/command/snapshot_delete.rb', line 5 def execute super incorrect_arguments unless @args.count == 2 vm = VM.new @args[0] snap_name = @args[1] output "Deleting snapshot" response = vm.delete_snapshot snap_name if response.successful? output "Snapshot '#{snap_name}' deleted" else output_and_exit "There was an error deleting the snapshot. The error was:\n#{response.}", response.code end end |
#option_parser ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/fission/command/snapshot_delete.rb', line 22 def option_parser optparse = OptionParser.new do |opts| opts. = "Usage: fission snapshot delete TARGET_VM SNAPSHOT_NAME" opts.separator '' opts.separator 'Deletes the snapshot SNAPSHOT_NAME of TARGET_VM' end optparse end |
#summary ⇒ Object
32 33 34 |
# File 'lib/fission/command/snapshot_delete.rb', line 32 def summary 'Delete a snapshot of a VM' end |