Class: Chef::Knife::SlServerList
Instance Method Summary
collapse
Methods included from SlBase
#connection, #current_domain, included, #list_firewalls, #list_vlans, #locate_config_value
Instance Method Details
#list_servers(domain = nil) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/chef/knife/sl_server_list.rb', line 39
def list_servers(domain = nil)
server_list = ["ID", "Name", "Public IP", "Private IP", "Management IP", "Notes"]
server_list.map!{ |f| ui.color(f, :bold) }
connection.getHardware.find_all.each do |server|
next if domain && server['domain'] != domain
server_list << server['id'].to_s
server_list << server['fullyQualifiedDomainName'].to_s
server_list << server['primaryIpAddress'].to_s
server_list << server['privateIpAddress'].to_s
server_list << server['networkManagementIpAddress'].to_s
server_list << server['notes'].to_s
end
return server_list
end
|
#run ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/chef/knife/sl_server_list.rb', line 30
def run
$stdout.sync = true
server_list = list_servers(current_domain)
puts "Listing instances"
puts ui.list(server_list, :uneven_columns_across, 6)
end
|