Commit 55608031 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(configd) align exception handling

(cherry picked from commit 8f92a6a2)
parent a6ca7de3
...@@ -450,8 +450,9 @@ class Action(object): ...@@ -450,8 +450,9 @@ class Action(object):
else: else:
syslog.syslog(syslog.LOG_ERR, '[%s] returned exit status %d' % (message_uuid, exit_status)) syslog.syslog(syslog.LOG_ERR, '[%s] returned exit status %d' % (message_uuid, exit_status))
return 'Error (%d)' % exit_status return 'Error (%d)' % exit_status
except: except Exception as script_exception:
syslog.syslog(syslog.LOG_ERR, '[%s] Script action failed at %s' % (message_uuid, syslog.syslog(syslog.LOG_ERR, '[%s] Script action failed with %s at %s' % (message_uuid,
script_exception,
traceback.format_exc())) traceback.format_exc()))
return 'Execute error' return 'Execute error'
elif self.type.lower() == 'script_output': elif self.type.lower() == 'script_output':
...@@ -469,8 +470,9 @@ class Action(object): ...@@ -469,8 +470,9 @@ class Action(object):
script_error_output.strip()[:255]) script_error_output.strip()[:255])
) )
return script_output return script_output
except: except Exception as script_exception:
syslog.syslog(syslog.LOG_ERR, '[%s] Script action failed at %s' % (message_uuid, syslog.syslog(syslog.LOG_ERR, '[%s] Script action failed with %s at %s' % (message_uuid,
script_exception,
traceback.format_exc())) traceback.format_exc()))
return 'Execute error' return 'Execute error'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment