Sanitize ansible results in mqtt callback plugin

According to https://github.com/ansible/ansible/issues/22505 the raw
raw results returned should be sanitized with the
CallbackBase._dump_results() method to ensure sensitive strings such
as those flagged by no_log are elided.

Change-Id: Iaebba820ffcb8628cf1e2373546e51ffc02deed6
This commit is contained in:
Jeremy Stanley 2017-04-29 15:07:02 +00:00
parent 1ef6088bb6
commit 477b6093e0

View File

@ -208,7 +208,7 @@ class CallbackModule(CallbackBase):
'playbook_name': self.playbook,
'playbook_id': self.uuid,
'ansible_task': str(result._task),
'ansible_result': result._result
'ansible_result': self._dump_results(result._result)
}
self._publish(topic, json.dumps(data))
@ -225,7 +225,7 @@ class CallbackModule(CallbackBase):
'playbook_name': self.playbook,
'ansible_host': result._host.name,
'ansible_task': str(result._task),
'ansible_result': result._result
'ansible_result': self._dump_results(result._result)
}
self._publish(topic, json.dumps(data))
@ -242,7 +242,7 @@ class CallbackModule(CallbackBase):
'playbook_id': self.uuid,
'ansible_host': host,
'ansible_task': str(result._task),
'ansible_result': result._result
'ansible_result': self._dump_results(result._result)
}
self._publish(topic, json.dumps(data))
@ -259,6 +259,6 @@ class CallbackModule(CallbackBase):
'playbook_id': self.uuid,
'ansible_host': result._host.name,
'ansible_task': str(result._task),
'ansible_result': result._result
'ansible_result': self._dump_results(result._result)
}
self._publish(topic, json.dumps(data))