class Iso

Public Instance Methods

attach() click to toggle source
   # File lib/cloudstack-cli/commands/iso.rb
52 def attach
53   resolve_iso
54   resolve_project
55   unless options[:virtual_machine_id]
56    resolve_virtual_machine
57   end
58   options[:id] = options[:iso_id]
59   client.attach_iso(options.merge(sync: false))
60   say " OK", :green
61 end
detach() click to toggle source
   # File lib/cloudstack-cli/commands/iso.rb
67 def detach
68   resolve_project
69   unless options[:virtual_machine_id]
70     resolve_virtual_machine
71   end
72   client.detach_iso(options.merge(sync: true))
73   say " OK", :green
74 end
list() click to toggle source
   # File lib/cloudstack-cli/commands/iso.rb
13 def list
14   add_filters_to_options("listIsos") if options[:filter]
15   resolve_project
16   resolve_zone
17   resolve_account
18   options[:isofilter] = options[:type]
19   options.delete :type
20   isos = client.list_isos(options)
21   isos = filter_objects(isos) if options[:filter]
22   if isos.size < 1
23     puts "No ISO's found."
24   else
25     case options[:format].to_sym
26     when :yaml
27       puts({isos: isos}.to_yaml)
28     when :json
29       puts JSON.pretty_generate(isos: isos)
30     else
31       table = [%w(Name Zone Bootable Public Featured)]
32       isos.each do |iso|
33         table <<  [
34           iso['name'],
35           iso['zonename'],
36           iso['bootable'],
37           iso['ispublic'],
38           iso['isfeatured']
39         ]
40       end
41       print_table(table)
42       say "Total number of ISO's: #{isos.size}"
43     end
44   end
45 end