Class: CommandInterfaceHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/proto/command_interface_handler.rb

Instance Method Summary collapse

Instance Method Details

#run_command(cld, command, args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/proto/command_interface_handler.rb', line 2

def run_command(cld, command, args)
      
  cr = CloudThrift::CloudResponse.new
  cr.name = cld.name
  cr.command = command
  resp = begin
    the_cloud = clouds[cld.name]
    the_cloud ? the_cloud.send(command.to_sym, *args) : "Cloud not found: #{cld.name}"
  rescue Exception => e
    cr.response = "Error: #{e.inspect}"
  end
  
  cr.response = format_response(resp)

  return cr
end