summaryrefslogtreecommitdiffstats
path: root/lib/gce_command.rb
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-02-19 15:30:26 -0500
committerKenny Woodson <kwoodson@redhat.com>2015-02-19 15:33:10 -0500
commitb3507fa9b3e03f431c5de00a10137ddcf354593e (patch)
tree0b1a8bf82bbbd0cc6c464b6aa2723cf1a2abbfe9 /lib/gce_command.rb
parent81db3db61f911cbbc6ff8f88b90cecb870c41381 (diff)
downloadopenshift-b3507fa9b3e03f431c5de00a10137ddcf354593e.tar.gz
openshift-b3507fa9b3e03f431c5de00a10137ddcf354593e.tar.bz2
openshift-b3507fa9b3e03f431c5de00a10137ddcf354593e.tar.xz
openshift-b3507fa9b3e03f431c5de00a10137ddcf354593e.zip
Fixed an issue with the latest gce list. Correctly handles _meta
Diffstat (limited to 'lib/gce_command.rb')
-rw-r--r--lib/gce_command.rb12
1 files changed, 9 insertions, 3 deletions
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