Debian Codegraph @

test/integration/targets/stacktrace_dump_remote/library/custom_module.py

raw
1 #!/usr/bin/python
2
3 from __future__ import annotations
4
5 import os
6 import signal
7 import tempfile
8
9 from ..module_utils.basic import AnsibleModule # pylint: disable=relative-beyond-top-level
10
11
12 def main():
13 module = AnsibleModule(
14 argument_spec=dict()
15 )
16
17 # Get PID of the current process (AnsiballZ)
18 process_pid = os.getpid()
19
20 # Send SIGUSR1 to the current process to trigger a stacktrace dump
21 os.kill(process_pid, signal.SIGUSR1)
22
23 # Exit with the stacktrace dir and AnsiballZ PID
24 module.exit_json(
25 trace_dir=tempfile.gettempdir(),
26 process_pid=process_pid
27 )
28
29
30 if __name__ == '__main__':
31 main()