Sha256: 608ca19f3590a568382f1f82dd188d66ec91a53da22776e7b8807ad7c1ea8946

Contents?: true

Size: 1.17 KB

Versions: 28

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../lib")

require "poolparty"
require 'git-style-binary/command'

GitStyleBinary.command do
  banner <<-EOS
Usage: #{$0} #{all_options_string}

  List the clouds and their nodes
  e.g. show a list of the current instances on the cloud
EOS

  opt :instance_id, "Describe a specific instance", :type => String, :default => nil

  short_desc "show a list of the current instances on the clouds"

  run do |command|
    @loaded_clouds.each do |cld|
      if command[:instance_id]
        require 'pp'
        pp result = cld.nodes(:instance_id=>command[:instance_id])
      else
        line = "-----------------------------"
        msg = ["Listing cloud #{cld.name}"]

        hsh = {}
        cld.describe_instances(:keypair_name => cld.keypair.basename).each do |n| 
          (hsh[n.status] ||= []) << n
        end
        
        hsh.each do |k,v|
          msg << "#{k.capitalize} nodes"
          msg << line
          v.each do |a|
            msg << "  #{a[:instance_id] || a[:id]}\t#{a[:ip] || a[:public_ip] || a[:name]}"
          end
          msg << ""
        end
        
        print_msg(msg)
      end
      
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 bin/cloud-list
auser-poolparty-1.3.1 bin/cloud-list
auser-poolparty-1.3.10 bin/cloud-list
auser-poolparty-1.3.11 bin/cloud-list
auser-poolparty-1.3.12 bin/cloud-list
auser-poolparty-1.3.13 bin/cloud-list
auser-poolparty-1.3.14 bin/cloud-list
auser-poolparty-1.3.15 bin/cloud-list
auser-poolparty-1.3.16 bin/cloud-list
auser-poolparty-1.3.17 bin/cloud-list
auser-poolparty-1.3.2 bin/cloud-list
auser-poolparty-1.3.3 bin/cloud-list
auser-poolparty-1.3.4 bin/cloud-list
auser-poolparty-1.3.5 bin/cloud-list
auser-poolparty-1.3.6 bin/cloud-list
auser-poolparty-1.3.7 bin/cloud-list
auser-poolparty-1.3.8 bin/cloud-list
fairchild-poolparty-1.3.17 bin/cloud-list
fairchild-poolparty-1.3.5 bin/cloud-list
poolparty-1.3.15 bin/cloud-list