lib/proto/command_interface_handler.rb in auser-poolparty-1.3.5 vs lib/proto/command_interface_handler.rb in auser-poolparty-1.3.6
- old
+ new
@@ -4,10 +4,26 @@
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}"
+ if the_cloud
+ if command.include?(".")
+ command.split(".").inject([]) do |sum, cmd|
+ if cmd.match(/\((.*)\)/)
+ args = $1
+ new_cmd = cmd.gsub(args, '').gsub(/\(\)/, '')
+ sum = arr.send(new_cmd.to_sym, *args)
+ else
+ sum = arr.send(cmd)
+ end
+ end
+ else
+ the_cloud.send(command.to_sym, *args)
+ end
+ else
+ "Cloud not found: #{cld.name}"
+ end
rescue Exception => e
cr.response = "Error: #{e.inspect}"
end
cr.response = format_response(resp)
\ No newline at end of file