#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__) + "/../lib") require "poolparty" # require "poolpartycl" require 'git-style-binary/command' GitStyleBinary.command do version "PoolParty #{$0} command" 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 puts "Listing cloud #{cld.name}" puts "Active instances" puts cld.nodes(:status => "running").map{|a| "#{a[:instance_id] || a[:id]}\t#{a[:ip] ||a[:public_ip] }" }.join("\n") if cld.nodes(:status => "pending").size > 0 puts "Pending instances" puts cld.nodes(:status => "pending").map{|a| "#{a[:instance_id] || a[:id]}\t#{a[:ip] ||a[:public_ip] }" }.join("\n") end end end end end