lib/sfpagent/agent.rb in sfpagent-0.3.4 vs lib/sfpagent/agent.rb in sfpagent-0.3.5
- old
+ new
@@ -390,12 +390,13 @@
# Execute an action
#
# @param action contains the action's schema.
#
def self.execute_action(action)
- logger = (@@config[:daemon] ? Sfp::Agent.logger : Logger.new(STDOUT))
- action_string = "#{action['name']} #{JSON.generate(action['parameters'])}"
begin
+ logger = (@@config[:daemon] ? Sfp::Agent.logger : Logger.new(STDOUT))
+ action_string = "#{action['name']} #{JSON.generate(action['parameters'])}"
+ logger.info "Executing #{action_string} [Wait]"
result = @@runtime.execute_action(action)
logger.info "Executing #{action_string} " + (result ? "[OK]" : "[Failed]")
return result
rescue Exception => e
logger.error "Executing #{action_string} [Failed] #{e}\n#{e.backtrace.join("\n")}"