Actions
Bug #20564
closednode_settings module should not throw an exception when no token is passed and the playbook is not run on the rudder server
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
Description
If I forget to pass the token as parameter, it tries to read it on the target host, but if it is not a rudder server it throws an exception:
PLAY [Test the node_settings module] ********************************************************************************************************************************************************** TASK [Make sure we have id or name parameter] ************************************************************************************************************************************************* An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] Aucun fichier ou dossier de ce type: '/var/rudder/run/api-token' fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/fdallidet/.ansible/tmp/ansible-tmp-1642069388.1954112-91786-118576904417196/AnsiballZ_node_settings.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/fdallidet/.ansible/tmp/ansible-tmp-1642069388.1954112-91786-118576904417196/AnsiballZ_node_settings.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/fdallidet/.ansible/tmp/ansible-tmp-1642069388.1954112-91786-118576904417196/AnsiballZ_node_settings.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.rudder.rudder.plugins.modules.node_settings', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.9/runpy.py\", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_rudder.rudder.node_settings_payload_algw857w/ansible_rudder.rudder.node_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/node_settings.py\", line 485, in <module>\n File \"/tmp/ansible_rudder.rudder.node_settings_payload_algw857w/ansible_rudder.rudder.node_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/node_settings.py\", line 454, in main\n File \"/tmp/ansible_rudder.rudder.node_settings_payload_algw857w/ansible_rudder.rudder.node_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/node_settings.py\", line 210, in __init__\nFileNotFoundError: [Errno 2] Aucun fichier ou dossier de ce type: '/var/rudder/run/api-token'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} ...ignoring TASK [assert] ********************************************************************************************************************************************************************************* fatal: [localhost]: FAILED! => { "assertion": "'node_id' in result.msg", "changed": false, "evaluated_to": false, "msg": "Assertion failed" } PLAY RECAP ************************************************************************************************************************************************************************************ localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=1
Actions