Sha256: 2f36780452d48dcb0f90d1ed338974438cacf0a1cb7b3e44cc0f86c363454d02

Contents?: true

Size: 995 Bytes

Versions: 2

Compression:

Stored size: 995 Bytes

Contents

class Iso < CloudstackCli::Base

  desc 'list', "list iso's"
  option :project
  option :zone
  option :account
  option :type,
    enum: %w(featured self selfexecutable sharedexecutable executable community all)
  def list
    resolve_project
    resolve_zone
    resolve_account
    options[:isofilter] = options[:type]
    options.delete :type
    isos = client.list_isos(options)
    if isos.size < 1
      puts "No iso's found."
    else
      table = [%w(Name Zone Bootable Public Featured)]
      isos.each do |iso|
        table <<  [
          iso['name'],
          iso['zonename'],
          iso['bootable'],
          iso['ispublic'],
          iso['isfeatured']
        ]
      end
      print_table(table)
      say "Total number of isos: #{isos.size}"
    end
  end

  desc 'detach VM_ID', "detaches any ISO file (if any) currently attached to a virtual machine"
  def detach(vm_id)
    client.detach_iso({virtualmachine_id: vm_id}, {sync: true})
    say " OK", :green
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cloudstack-cli-1.2.7 lib/cloudstack-cli/commands/iso.rb
cloudstack-cli-1.2.6 lib/cloudstack-cli/commands/iso.rb