#!/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| puts "#{pool.name}" puts "===" @loaded_clouds.each do |cld| if command[:instance_id] require 'pp' pp result = cld.nodes(:instance_id=>command[:instance_id]) else msg = ["* #{cld.name} cloud, #{cld.image_id}, #{cld.instance_type}"] hsh = {} cld.all_nodes.each do |n| (hsh[n.status] ||= []) << n end hsh.each do |k,v| msg << " - #{k} nodes" v.each do |a| msg << " - #{a.instance_id}\t#{a.status}\t#{a.public_ip}\t#{a.private_ip}\t#{a.zone}" end msg << "" end puts msg end end end end