Class: Chef::Knife::AzureAgList

Inherits:
Chef::Knife show all
Includes:
AzureBase
Defined in:
lib/chef/knife/azure_ag_list.rb

Instance Method Summary collapse

Methods included from AzureBase

#connection, #find_file, included, #is_image_windows?, #locate_config_value, #msg_pair, #msg_server_summary, #parse_publish_settings_file, #validate!

Instance Method Details

#hlObject



30
31
32
# File 'lib/chef/knife/azure_ag_list.rb', line 30

def hl
  @highline ||= HighLine.new
end

#runObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/chef/knife/azure_ag_list.rb', line 34

def run
  $stdout.sync = true

  validate!

  cols = %w{Name Location Description}

  the_list = cols.map { |col| ui.color(col, :bold) }
  connection.ags.all.each do |ag|
    cols.each { |attr| the_list << ag.send(attr.downcase).to_s }
  end

  puts "\n"
  puts hl.list(the_list, :uneven_columns_across, cols.size)
end