1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Implement hide task arguments feature (#40176)

* Implement hide task arguments feature

* Add version_added field

* Include changelog file
This commit is contained in:
sdirbach 2018-12-03 10:22:51 +01:00 committed by John R Barker
parent 672acbea68
commit 840ab706ee
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- junit callback plug-in - introduce a new option to hide task arguments similar to no_log.

View file

@ -58,6 +58,13 @@ DOCUMENTATION = '''
description: Should the setup tasks be included in the final report
env:
- name: JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT
hide_task_arguments:
name: Hide the arguments for a task
default: False
description: Hide the arguments for a task
version_added: "2.8"
env:
- name: JUNIT_HIDE_TASK_ARGUMENTS
requirements:
- whitelist in configuration
- junit_xml (python lib)
@ -113,6 +120,8 @@ class CallbackModule(CallbackBase):
Default: False
JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT (optional): Should the setup tasks be included in the final report
Default: True
JUNIT_HIDE_TASK_ARGUMENTS (optional): Hide the arguments for a task
Default: False
Requires:
junit_xml
@ -133,6 +142,7 @@ class CallbackModule(CallbackBase):
self._fail_on_change = os.getenv('JUNIT_FAIL_ON_CHANGE', 'False').lower()
self._fail_on_ignore = os.getenv('JUNIT_FAIL_ON_IGNORE', 'False').lower()
self._include_setup_tasks_in_report = os.getenv('JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT', 'True').lower()
self._hide_task_arguments = os.getenv('JUNIT_HIDE_TASK_ARGUMENTS', 'False').lower()
self._playbook_path = None
self._playbook_name = None
self._play_name = None
@ -168,7 +178,7 @@ class CallbackModule(CallbackBase):
path = task.get_path()
action = task.action
if not task.no_log:
if not task.no_log and self._hide_task_arguments == 'false':
args = ', '.join(('%s=%s' % a for a in task.args.items()))
if args:
name += ' ' + args