Class: Chef::Knife::SoftlayerServerList

Inherits:
Chef::Knife show all
Includes:
SoftlayerBase
Defined in:
lib/chef/knife/softlayer_server_list.rb

Constant Summary

Constants included from SoftlayerBase

Chef::Knife::SoftlayerBase::USER_AGENT

Instance Method Summary collapse

Methods included from SoftlayerBase

#compute, #connection, included, #locate_config_value, #msg_pair, #network

Instance Method Details

#runnil

Run the procedure to list all of the Softlayer VM’s

Returns:

  • (nil)


16
17
18
19
20
21
22
23
24
# File 'lib/chef/knife/softlayer_server_list.rb', line 16

def run

  $stdout.sync = true
  fmt = "%-20s %-8s %-15s %-15s %-10s"
  puts ui.color(sprintf(fmt, "Name", "Location", "Public IP", "Private IP", "Status"), :green)
  connection.servers.each do |server|
    puts sprintf fmt, server.name, server.datacenter, server.public_ip_address, server.private_ip_address, server.created_at ? 'Running' : 'Starting'
  end
end