Currently if file inside cmd is not found the module will dump a stack trace.
The full traceback is:
Traceback (most recent call last):
File "/.ansible/tmp/ansible-tmp-1727908065.581223-318-121029589689214/AnsiballZ_zos_script.py", line 107, in <module>
_ansiballz_main()
File "/.ansible/tmp/ansible-tmp-1727908065.581223-318-121029589689214/AnsiballZ_zos_script.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/.ansible/tmp/ansible-tmp-1727908065.581223-318-121029589689214/AnsiballZ_zos_script.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_script', init_globals=dict(_module_fqn='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_script', _modlib_path=modlib_path),
File "<frozen runpy>", line 226, in run_module
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/tmp/ansible_ibm.ibm_zos_core.zos_script_payload_ewuw_poz/ansible_ibm.ibm_zos_core.zos_script_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_script.py", line 407, in <module>
File "/tmp/ansible_ibm.ibm_zos_core.zos_script_payload_ewuw_poz/ansible_ibm.ibm_zos_core.zos_script_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_script.py", line 403, in main
File "/tmp/ansible_ibm.ibm_zos_core.zos_script_payload_ewuw_poz/ansible_ibm.ibm_zos_core.zos_script_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_script.py", line 363, in run_module
FileNotFoundError: [Errno 129] EDC5129I No such file or directory.: './files/hello.sh'
fatal: [zvm]: FAILED! => {
"changed": false,
"module_stderr": "Shared connection to closed.\r\n",
"module_stdout": "Traceback (most recent call last):\r\n File \"/.ansible/tmp/ansible-tmp-1727908065.581223-318-121029589689214/AnsiballZ_zos_script.py\", line 107, in <module>\r\n _ansiballz_main()\r\n File \"/.ansible/tmp/ansible-tmp-1727908065.581223-318-121029589689214/AnsiballZ_zos_script.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/.ansible/tmp/ansible-tmp-1727908065.581223-318-121029589689214/AnsiballZ_zos_script.py\", line 47, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_script', init_globals=dict(_module_fqn='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_script', _modlib_path=modlib_path),\r\n File \"<frozen runpy>\", line 226, in run_module\r\n File \"<frozen runpy>\", line 98, in _run_module_code\r\n File \"<frozen runpy>\", line 88, in _run_code\r\n File \"/tmp/ansible_ibm.ibm_zos_core.zos_script_payload_ewuw_poz/ansible_ibm.ibm_zos_core.zos_script_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_script.py\", line 407, in <module>\r\n File \"/tmp/ansible_ibm.ibm_zos_core.zos_script_payload_ewuw_poz/ansible_ibm.ibm_zos_core.zos_script_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_script.py\", line 403, in main\r\n File \"/tmp/ansible_ibm.ibm_zos_core.zos_script_payload_ewuw_poz/ansible_ibm.ibm_zos_core.zos_script_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_script.py\", line 363, in run_module\r\nFileNotFoundError: [Errno 129] EDC5129I No such file or directory.: './files/hello.sh'\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Is there an existing issue for this?
Enhancement or feature description
Currently if file inside cmd is not found the module will dump a stack trace.
I think we can fail in a less verbose way.
Ansible module
zos_script