class Chef::Knife::CloudstackZoneList
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/cloudstack_zone_list.rb, line 29 def run $stdout.sync = true validate! zone_list = [ ui.color('ID', :bold), ui.color('Name', :bold), ui.color('Network Type', :bold), ui.color('Security Groups?', :bold) ] response = connection.list_zones['listzonesresponse'] if zones = response['zone'] zones.each do |zone| zone_list << zone['id'].to_s zone_list << zone['name'].to_s zone_list << zone['networktype'].to_s zone_list << begin state = zone['securitygroupsenabled'].to_s.downcase case state when 'false' ui.color('No', :red) else ui.color('Yes', :green) end end end end puts ui.list(zone_list, :columns_across, 4) end