Trying to authenticate with an expired cvp service account token while using the cv_facts_v3 module causes a misleading error message: "UnboundLocalError: local variable 'cv_devices' referenced before assignment" observed with CVP version 2022.2.2
it would be nice to have a clearer error message to indicate an authentication issue.
fatal: [cvp.x.net]: FAILED! => {"changed": false, "module_stderr": "/home/m019962-udm/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cvp.x.net'. Adding certificate verification is strongly advised. See:https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/home/m019962-udm/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cvp.x.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\n/home/m019962-udm/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cvp.x.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n warnings.warn(\nTraceback (most recent call last):\n File \"/home/m019962-udm/.ansible/tmp/ansible-local-449075m227c6n9/ansible-tmp-1697011376.2354372-449085-76368703535268/AnsiballZ_cv_facts_v3.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/m019962-udm/.ansible/tmp/ansible-local-449075m227c6n9/ansible-tmp-1697011376.2354372-449085-76368703535268/AnsiballZ_cv_facts_v3.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/m019962-udm/.ansible/tmp/ansible-local-449075m227c6n9/ansible-tmp-1697011376.2354372-449085-76368703535268/AnsiballZ_cv_facts_v3.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.arista.cvp.plugins.modules.cv_facts_v3', init_globals=dict(_module_fqn='ansible_collections.arista.cvp.plugins.modules.cv_facts_v3', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.9/runpy.py\", line 225, 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_arista.cvp.cv_facts_v3_payload_0lob9mzq/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py\", line 174, in <module>\n File \"/tmp/ansible_arista.cvp.cv_facts_v3_payload_0lob9mzq/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py\", line 164, in main\n File \"/tmp/ansible_arista.cvp.cv_facts_v3_payload_0lob9mzq/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py\", line 275, in facts\n File \"/tmp/ansible_arista.cvp.cv_facts_v3_payload_0lob9mzq/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py\", line 490, in __fact_devices\nUnboundLocalError: local variable 'cv_devices' referenced before assignment\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Issue Summary
Trying to authenticate with an expired cvp service account token while using the cv_facts_v3 module causes a misleading error message: "UnboundLocalError: local variable 'cv_devices' referenced before assignment" observed with CVP version 2022.2.2
it would be nice to have a clearer error message to indicate an authentication issue.
This is the environment where it was observed:
Which component(s) of AVD impacted
cv_facts_v3
How do you run AVD ?
Ansible CLI (with virtual-env or native python)
Input variables
No response
Steps to reproduce
No response
Relevant log output
Code of Conduct