Commit b3049270 authored by Ad Schellevis's avatar Ad Schellevis

(configd) send received output on script_output type when there is any, closes...

(configd) send received output on script_output type when there is any, closes https://github.com/opnsense/core/issues/951
parent c8b9eefb
...@@ -470,6 +470,7 @@ class Action(object): ...@@ -470,6 +470,7 @@ class Action(object):
traceback.format_exc())) traceback.format_exc()))
return 'Execute error' return 'Execute error'
elif self.type.lower() == 'script_output': elif self.type.lower() == 'script_output':
script_output = ""
try: try:
with tempfile.NamedTemporaryFile() as error_stream: with tempfile.NamedTemporaryFile() as error_stream:
with tempfile.NamedTemporaryFile() as output_stream: with tempfile.NamedTemporaryFile() as output_stream:
...@@ -489,7 +490,7 @@ class Action(object): ...@@ -489,7 +490,7 @@ class Action(object):
syslog.syslog(syslog.LOG_ERR, '[%s] Script action failed with %s at %s' % (message_uuid, syslog.syslog(syslog.LOG_ERR, '[%s] Script action failed with %s at %s' % (message_uuid,
script_exception, script_exception,
traceback.format_exc())) traceback.format_exc()))
return 'Execute error' return script_output
# fallback should never get here # fallback should never get here
return "type error" return "type 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