Sha256: b37c4c4e710ccc65a3366938be7aa8122ff8870aad5659ed0f3e295bc80d7e85

Contents?: true

Size: 877 Bytes

Versions: 27

Compression:

Stored size: 877 Bytes

Contents

class Host < CloudstackCli::Base

  desc 'list', 'list hosts'
  option :zone, desc: "lists hosts by zone"
  option :type, desc: "the host type"
  def list
    resolve_zone if options[:zone]
    hosts = client.list_hosts(options)
    if hosts.size < 1
      say "No hosts found."
    else
      table = [["Zone", "Type", "Cluster", "Name"]]
      hosts.each do |host|
        table << [
        	host['zonename'], host['type'], host['clustername'], host['name']
        ]
      end
      print_table table
      say "Total number of hosts: #{hosts.size}"
    end
  end

  desc 'show', 'show host details'
  def show(name)
    unless host = client.list_hosts(name: name).first
      say "No host with name '#{name}' found."
    else
      table = host.map do |key, value|
        [ set_color("#{key}:", :yellow), "#{value}" ]
      end
      print_table table
    end
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
cloudstack-cli-1.4.1 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.4.0 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.3.3 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.3.2 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.3.1 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.3.0 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.7 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.6 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.5 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.4 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.3 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.1 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.2.0 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.1.0 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.0.8 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.0.7 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.0.6 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.0.5 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.0.4 lib/cloudstack-cli/commands/host.rb
cloudstack-cli-1.0.3 lib/cloudstack-cli/commands/host.rb