Class: Chef::Knife::SoftlayerDatacenterShow

Inherits:
Chef::Knife
  • Object
show all
Includes:
SoftlayerBase
Defined in:
lib/chef/knife/softlayer_datacenter_show.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

#runObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/chef/knife/softlayer_datacenter_show.rb', line 25

def run
  unless name_args.size == 1
    puts ui.color("Specify exactly one datacenter to show.", :red)
    show_usage
    exit 1
  end

  $stdout.sync = true
  dc = connection(:network).datacenters.by_name(name_args[0])

  puts "#{ui.color("Long Name:", :green)} #{dc.long_name}"
  puts "#{ui.color("Name:", :green)} #{dc.name}"

  puts "#{ui.color("Routers:", :green)}"
  puts Formatador.display_table(dc.routers)

end