mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
fix no_log leaking with_items values
This commit is contained in:
@@ -318,6 +318,14 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
with self.capture_event_data('playbook_on_stats', **event_data):
|
with self.capture_event_data('playbook_on_stats', **event_data):
|
||||||
super(BaseCallbackModule, self).v2_playbook_on_stats(stats)
|
super(BaseCallbackModule, self).v2_playbook_on_stats(stats)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _get_event_loop(task):
|
||||||
|
if hasattr(task, 'loop_with'): # Ansible >=2.5
|
||||||
|
return task.loop_with
|
||||||
|
elif hasattr(task, 'loop'): # Ansible <2.4
|
||||||
|
return task.loop
|
||||||
|
return None
|
||||||
|
|
||||||
def v2_runner_on_ok(self, result):
|
def v2_runner_on_ok(self, result):
|
||||||
# FIXME: Display detailed results or not based on verbosity.
|
# FIXME: Display detailed results or not based on verbosity.
|
||||||
|
|
||||||
@@ -331,7 +339,7 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
remote_addr=result._host.address,
|
remote_addr=result._host.address,
|
||||||
task=result._task,
|
task=result._task,
|
||||||
res=result._result,
|
res=result._result,
|
||||||
event_loop=result._task.loop if hasattr(result._task, 'loop') else None,
|
event_loop=self._get_event_loop(result._task),
|
||||||
)
|
)
|
||||||
with self.capture_event_data('runner_on_ok', **event_data):
|
with self.capture_event_data('runner_on_ok', **event_data):
|
||||||
super(BaseCallbackModule, self).v2_runner_on_ok(result)
|
super(BaseCallbackModule, self).v2_runner_on_ok(result)
|
||||||
@@ -344,7 +352,7 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
res=result._result,
|
res=result._result,
|
||||||
task=result._task,
|
task=result._task,
|
||||||
ignore_errors=ignore_errors,
|
ignore_errors=ignore_errors,
|
||||||
event_loop=result._task.loop if hasattr(result._task, 'loop') else None,
|
event_loop=self._get_event_loop(result._task),
|
||||||
)
|
)
|
||||||
with self.capture_event_data('runner_on_failed', **event_data):
|
with self.capture_event_data('runner_on_failed', **event_data):
|
||||||
super(BaseCallbackModule, self).v2_runner_on_failed(result, ignore_errors)
|
super(BaseCallbackModule, self).v2_runner_on_failed(result, ignore_errors)
|
||||||
@@ -354,7 +362,7 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
host=result._host.get_name(),
|
host=result._host.get_name(),
|
||||||
remote_addr=result._host.address,
|
remote_addr=result._host.address,
|
||||||
task=result._task,
|
task=result._task,
|
||||||
event_loop=result._task.loop if hasattr(result._task, 'loop') else None,
|
event_loop=self._get_event_loop(result._task),
|
||||||
)
|
)
|
||||||
with self.capture_event_data('runner_on_skipped', **event_data):
|
with self.capture_event_data('runner_on_skipped', **event_data):
|
||||||
super(BaseCallbackModule, self).v2_runner_on_skipped(result)
|
super(BaseCallbackModule, self).v2_runner_on_skipped(result)
|
||||||
|
|||||||
@@ -177,6 +177,19 @@ def test_callback_plugin_receives_events(executor, cache, event, playbook):
|
|||||||
when: item != "SENSITIVE-SKIPPED"
|
when: item != "SENSITIVE-SKIPPED"
|
||||||
failed_when: item == "SENSITIVE-FAILED"
|
failed_when: item == "SENSITIVE-FAILED"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
'''}, # noqa, NOTE: with_items will be deprecated in 2.9
|
||||||
|
{'loop.yml': '''
|
||||||
|
- name: loop tasks should be suppressed with no_log
|
||||||
|
connection: local
|
||||||
|
hosts: all
|
||||||
|
gather_facts: no
|
||||||
|
tasks:
|
||||||
|
- shell: echo {{ item }}
|
||||||
|
no_log: true
|
||||||
|
loop: [ "SENSITIVE", "SENSITIVE-SKIPPED", "SENSITIVE-FAILED" ]
|
||||||
|
when: item != "SENSITIVE-SKIPPED"
|
||||||
|
failed_when: item == "SENSITIVE-FAILED"
|
||||||
|
ignore_errors: yes
|
||||||
'''}, # noqa
|
'''}, # noqa
|
||||||
])
|
])
|
||||||
def test_callback_plugin_no_log_filters(executor, cache, playbook):
|
def test_callback_plugin_no_log_filters(executor, cache, playbook):
|
||||||
|
|||||||
Reference in New Issue
Block a user