Sha256: 6494458918472b76ee08989063a620ce9908bb193f96172a3ba31870ff2f8174

Contents?: true

Size: 862 Bytes

Versions: 8

Compression:

Stored size: 862 Bytes

Contents

class SystemVm < CloudstackCli::Base

  desc 'list', 'list system vms'
  option :zone
  def list
    vms = client.list_system_vms(options)
    if vms.size < 1
      say "No system vms found."
    else
      table = [["Zone", "State", "Type", "Name"]]
      vms.each do |vm|
        table << [
          vm['zonename'], vm['state'], vm['systemvmtype'], vm['name']
        ]
      end
      print_table table
      say "Total number of system vms: #{vms.size}"
    end
  end

  desc 'show [name]', 'show system vm'
  option :zone
  def show(name)
    vms = client.list_system_vms(options)
    vms = filter_by(vms, 'name', name)
    vm = vms.first
    unless vm
      say "No system vm with name #{name} found."
    else
      table = vm.map do |key, value|
        [ set_color("#{key}:", :yellow), "#{value}" ]
      end
      print_table table
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cloudstack-cli-0.13.1 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.13.0 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.12.3 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.12.2 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.12.1 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.12.0 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.11.2 lib/cloudstack-cli/commands/system_vm.rb
cloudstack-cli-0.11.1 lib/cloudstack-cli/commands/system_vm.rb