Debian Codegraph @

test/integration/targets/secret_masking_display/library/display_probe.py

raw
1 #!/usr/bin/python
2 # Copyright: Contributors to the Ansible project
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4 from __future__ import annotations
5
6 DOCUMENTATION = """
7 module: display_probe
8 short_description: route text through Display sinks for secret-masking tests
9 description:
10 - Test helper for the controller C(Display) egress sinks.
11 - Emits the supplied text via C(module.warn) and C(module.deprecate) so the warning
12 and deprecation sinks can be checked for masking.
13 - Accepts C(invocation_arg) which is intentionally NOT returned in the result, so it
14 only appears in the injected C(invocation) dump (with C(INJECT_INVOCATION) enabled
15 at C(-vvv)); that isolates the invocation-display sink from ordinary result masking.
16 options:
17 warning:
18 description: text to emit via C(module.warn).
19 type: str
20 required: true
21 deprecation:
22 description: text to emit via C(module.deprecate).
23 type: str
24 required: true
25 invocation_arg:
26 description: arbitrary text that surfaces only in the invocation dump.
27 type: str
28 required: true
29 """
30
31 from ansible.module_utils.basic import AnsibleModule
32
33
34 def main():
35 module = AnsibleModule(
36 argument_spec=dict(
37 warning=dict(type='str', required=True),
38 deprecation=dict(type='str', required=True),
39 invocation_arg=dict(type='str', required=True),
40 ),
41 )
42
43 module.warn(module.params['warning'])
44 module.deprecate(module.params['deprecation'], version='9.9.9')
45
46 # invocation_arg is deliberately not echoed back, so it only appears in the invocation dump
47 module.exit_json(changed=False)
48
49
50 if __name__ == '__main__':
51 main()