Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error message when CVP token auth fails #603

Open
1 task done
sebastianw opened this issue Mar 31, 2023 · 2 comments
Open
1 task done

Unhelpful error message when CVP token auth fails #603

sebastianw opened this issue Mar 31, 2023 · 2 comments
Labels
help wanted Extra attention is needed status: Triage New incoming issue type: bug Something isn't working
Milestone

Comments

@sebastianw
Copy link

Issue Summary

When token authentication fails while retrieving CVP facts, the error message is unhelpful. There seems to be no error handling for this case. Also the actual CVP error message is logged by invoking MODULE_LOGGER.error which is not displayed by Ansible.

Ansible Task:

- name: Gather CVP facts
  arista.cvp.cv_facts_v3:
    facts:
      - devices
  register: cvp_facts

Error Message:

ASK [corp.cvp.upload_config : Gather CVP facts] ***************************************************************************************
Friday 31 March 2023  09:49:55 +0200 (0:00:00.020)       0:00:01.876 **********
fatal: [cvp.test.corp.de]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

/Users/dummyuser/repositories/work/testcvp1/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cvp.test.corp.de'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/Users/dummyuser/repositories/work/testcvp1/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cvp.test.corp.de'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/Users/dummyuser/repositories/work/testcvp1/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cvp.test.corp.de'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
Traceback (most recent call last):
  File "/Users/dummyuser/.ansible/tmp/ansible-local-56212b3ist0rc/ansible-tmp-1680248996.800731-56291-56091543789778/AnsiballZ_cv_facts_v3.py", line 107, in <module>
    _ansiballz_main()
  File "/Users/dummyuser/.ansible/tmp/ansible-local-56212b3ist0rc/ansible-tmp-1680248996.800731-56291-56091543789778/AnsiballZ_cv_facts_v3.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/dummyuser/.ansible/tmp/ansible-local-56212b3ist0rc/ansible-tmp-1680248996.800731-56291-56091543789778/AnsiballZ_cv_facts_v3.py", line 47, in invoke_module
    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),
  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 "/var/folders/nv/vdqjyk_d4sqd0h_sxl5q_rsw0000gn/T/ansible_arista.cvp.cv_facts_v3_payload_4gs1b37z/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py", line 152, in <module>
  File "/var/folders/nv/vdqjyk_d4sqd0h_sxl5q_rsw0000gn/T/ansible_arista.cvp.cv_facts_v3_payload_4gs1b37z/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py", line 143, in main
  File "/var/folders/nv/vdqjyk_d4sqd0h_sxl5q_rsw0000gn/T/ansible_arista.cvp.cv_facts_v3_payload_4gs1b37z/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py", line 275, in facts
  File "/var/folders/nv/vdqjyk_d4sqd0h_sxl5q_rsw0000gn/T/ansible_arista.cvp.cv_facts_v3_payload_4gs1b37z/ansible_arista.cvp.cv_facts_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py", line 490, in __fact_devices
UnboundLocalError: cannot access local variable 'cv_devices' where it is not associated with a value

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

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sebastianw sebastianw added the type: bug Something isn't working label Mar 31, 2023
@sugetha24 sugetha24 added the status: Triage New incoming issue label Apr 4, 2023
@sugetha24 sugetha24 added this to the v4.0.0 milestone Apr 4, 2023
@github-actions
Copy link

github-actions bot commented Jul 4, 2023

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added the state: stale Staled issues waiting for closure label Jul 4, 2023
@sugetha24 sugetha24 removed the state: stale Staled issues waiting for closure label Jan 8, 2024
@sugetha24 sugetha24 reopened this Jan 8, 2024
@sugetha24 sugetha24 added the help wanted Extra attention is needed label Jan 31, 2024
@sugetha24 sugetha24 modified the milestones: v4.0.0, v3.11.0 Feb 16, 2024
@sugetha24
Copy link
Contributor

@sebastianw What is ansible-cvp version you tested this on? And what CVP version was this? On my end, this is what I am seeing with invalid token on on-perm cvp version: 2023.1.1 and ansible-cvp version 3.10.1

(avd) ➜  Facts ansible-playbook facts_devices.yml -i ../Inventory_files/inventory_ATD.yml     

PLAY [cv_facts_v3 benchmarking] ******************************************************************************************************************************************************************************************************************************************

TASK [gather cvp facts] **************************************************************************************************************************************************************************************************************************************************
fatal: [CloudVision]: FAILED! => changed=false 
  msg: 'GET: https://staticstudio-1-cfec4cc2-eos.topo.testdrive.arista.com:443/web/cvpInfo/getCvpInfo.do : Request Error: Unauthorized'

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************************
CloudVision                : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed status: Triage New incoming issue type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants