From b3507fa9b3e03f431c5de00a10137ddcf354593e Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Thu, 19 Feb 2015 15:30:26 -0500 Subject: Fixed an issue with the latest gce list. Correctly handles _meta --- lib/gce_command.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/gce_command.rb') diff --git a/lib/gce_command.rb b/lib/gce_command.rb index b0a84d27b..b23834af5 100644 --- a/lib/gce_command.rb +++ b/lib/gce_command.rb @@ -120,14 +120,20 @@ module OpenShift ah.run_playbook("playbooks/gce/#{host_type}/terminate.yml") end + option :env, :required => false, :aliases => '-e', :enum => SUPPORTED_ENVS, + :desc => 'The environment to list.' desc "list", "Lists instances." def list() hosts = GceHelper.get_hosts() + hosts.delete_if { |h| h.env != options[:env] } unless options[:env].nil? + + fmt_str = "%34s %5s %8s %17s %7s" + puts - puts "Instances" - puts "---------" - hosts.each { |k| puts " #{k.name}" } + puts fmt_str % ['Name','Env', 'State', 'IP Address', 'Created By'] + puts fmt_str % ['----','---', '-----', '----------', '----------'] + hosts.each { |h| puts fmt_str % [h.name, h.env, h.state, h.public_ip, h.created_by ] } puts end -- cgit v1.2.3