Update Python runner code to simply return action result as is
(serialized as string) in case the result contains non-simple type and
we can't de-serialize it.
# limitations under the License.
import os
+import re
import sys
import json
import uuid
@@ -180,14 +181,20 @@ class PythonRunner(ActionRunner):
action_result = json.loads(action_result)
except Exception as e:
# Failed to de-serialize the result, probably it contains non-simple type or similar
- # TODO: Should we throw instead?
LOG.warning('Failed to de-serialize result "%s": %s' % (str(action_result), str(e)))
+ pass
if action_result and isinstance(action_result, dict):
result = action_result.get('result', None)
status = action_result.get('status', None)
else:
- result = 'None'
+ # Failed to de-serialize return result as is aka as a string
+ match = re.search("'result': (.*?)$", action_result).groups()
+
+ if match:
+ action_result = match[0]
+
+ result = action_result
status = None
output = {
