class Chef::Knife::PodnixServerShow

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/podnix_server_show.rb, line 26
def run
@server_id = @name_args[0]
  if @server_id.nil?
    ui.error("You must specify a server_id")
    exit 1        
 else
 
  validate!
  @podnix = Podnix::API.new({:key => "#{config[:podnix_api_key]}"})
  po_server = @podnix.get_server({:id => "#{@server_id}"})

  server_show = [
      ui.color('ID', :bold),
      ui.color('Name', :bold)]


  po_server.data[:body]['data'].each do |im|
    server_show << im['id']
    server_show << im['name']
  end

  puts ui.list(server_show, :uneven_columns_across, 2)
end
end