From f5b095f6c83c780855d2f34f6a49f1c424bea6f0 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 30 Oct 2015 16:42:06 -0400 Subject: [PATCH] properly sanitize registered vars --- lib/ansible/executor/process/result.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/executor/process/result.py b/lib/ansible/executor/process/result.py index 9e1f6921f48..fe5d0293c47 100644 --- a/lib/ansible/executor/process/result.py +++ b/lib/ansible/executor/process/result.py @@ -21,6 +21,7 @@ __metaclass__ = type from ansible.compat.six.moves import queue from ansible.compat.six import iteritems, text_type +from ansible.vars import strip_internal_keys import multiprocessing import time @@ -103,9 +104,13 @@ class ResultProcess(multiprocessing.Process): time.sleep(0.01) continue + clean_copy = strip_internal_keys(result._result) + if 'invocation' in clean_copy: + del clean_copy['invocation'] + # if this task is registering a result, do it now if result._task.register: - self._send_result(('register_host_var', result._host, result._task.register, result._result)) + self._send_result(('register_host_var', result._host, result._task.register, clean_copy)) # send callbacks, execute other options based on the result status # TODO: this should all be cleaned up and probably moved to a sub-function.