Skip to content

Using cv_validate_v3 3.10.1 with cvprac>=1.4.0 fails due to changes in cvprac #724

Open
@spangoli-arista

Description

@spangoli-arista

Issue Summary

Hello,

We have been using with no issue cv_validate_v3 to check our configuration without issue using arista.cvp 3.10.1 and cvprac 1.3.2.
Recently, we noticed the same playbook fails when we run it in a newly-build container, with this error:

    {
    "module_stdout": "",
    "module_stderr": "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host 'n-cvp.infra.oneadr.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/usr/lib/python3.9/site-packages/urllib3/connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host 'n-cvp.infra.oneadr.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/usr/lib/python3.9/site-packages/urllib3/connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host 'n-cvp.infra.oneadr.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  warnings.warn(\nTraceback (most recent call last):\n  File \"/home/runner/.ansible/tmp/ansible-local-21oo0hrmmj/ansible-tmp-1743680729.735365-117-267772080974879/AnsiballZ_cv_validate_v3.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/runner/.ansible/tmp/ansible-local-21oo0hrmmj/ansible-tmp-1743680729.735365-117-267772080974879/AnsiballZ_cv_validate_v3.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/runner/.ansible/tmp/ansible-local-21oo0hrmmj/ansible-tmp-1743680729.735365-117-267772080974879/AnsiballZ_cv_validate_v3.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.arista.cvp.plugins.modules.cv_validate_v3', init_globals=dict(_module_fqn='ansible_collections.arista.cvp.plugins.modules.cv_validate_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_validate_v3_payload_im71fd_2/ansible_arista.cvp.cv_validate_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_validate_v3.py\", line 163, in <module>\n  File \"/tmp/ansible_arista.cvp.cv_validate_v3_payload_im71fd_2/ansible_arista.cvp.cv_validate_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_validate_v3.py\", line 153, in main\n  File \"/tmp/ansible_arista.cvp.cv_validate_v3_payload_im71fd_2/ansible_arista.cvp.cv_validate_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/validate_tools.py\", line 194, in manager\nTypeError: validate_config_for_device() got an unexpected keyword argument 'device_mac'\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1,
    "_ansible_no_log": null,
    "changed": false
    }

The root cause seems to be this:

    **validate_config_for_device() got an unexpected keyword argument 'device_mac'\n",**

This function is defined in cvprac - indeed, between 1.3.2 and 1.4.0 the names of the parameters for validate_config_for_device(}
changed, and instead of device_mac now the parameter is called dev_mac:

https://github.com/aristanetworks/cvprac/blob/v1.4.0/cvprac/cvp_api.py
def validate_config_for_device(self, dev_mac, config):
''' Validate a config against a device

        Args:
            dev_mac (str): Device MAC address    <---------
            config (str): Switch config statements

This was in cvprac v.1.3.1

    def validate_config_for_device(self, device_mac, config):
        ''' Validate a config against a device

            Args:
                device_mac (str): Device MAC address
                config (str): Switch config statements

Last thing, in the requirement.txt for ansible-cvp 3.x.x, the requirements for cvprac is >=1.2.0.
It might be missing an additional requirement cvprac<1.4.0

Which component(s) of AVD impacted

None

How do you run AVD ?

None

Input variables

Steps to reproduce

This seems to be constantly reproducible when using cv_validate_v3 and cvprac 1.4.0 or greater.

Relevant log output

This is the "broken" environment, where validation fails:

"Collection            Version",
            "--------------------- -------",
            "community.general     7.3.0  ",
            "",
            "# /usr/share/ansible/collections/ansible_collections",
            "Collection            Version",
            "--------------------- -------",
            "ansible.netcommon     7.0.0  ",
            "ansible.posix         1.5.4  ",
            "ansible.utils         5.0.0  ",
            "arista.avd            4.6.0  ",
            "arista.cvp            3.10.1 ",
            "arista.eos            10.0.0 ",
            "community.general     9.2.0  ",
            "community.mongodb     1.7.5  ",
            "cyberark.pas          1.0.27 ",
            "infoblox.nios_modules 1.6.1  "
			
			
            "ansible-compat==3.0.2",
            "ansible-core==2.15.3",
            "ansible-lint==6.14.3",
            "ansible-pylibssh==1.2.2",
            "ansible-runner==2.3.2",
            "aristaproto==0.1.2",
            "attrs==21.4.0",
            "bcrypt==3.2.0",
            "black==22.8.0",
            "bracex==2.2.1",
            "certifi==2024.7.4",
            "cffi==1.15.0",
            "chardet==3.0.4",
            "charset-normalizer==3.3.2",
            "click==8.1.3",
            "commonmark==0.9.1",
            "cryptography==38.0.4",
            "cvprac==1.4.0",
            "debtcollector==3.0.0",
            "decorator==5.1.1",
            "deepmerge==1.1.1",
            "dnspython==2.6.1",
            "docutils==0.16",
            "filelock==3.8.0",
            "fpyutils==4.0.1",
            "future==0.18.3",
            "grpcio==1.65.1",
            "grpclib==0.4.7",
            "gssapi==1.8.2",
            "h2==4.1.0",
            "hpack==4.0.0",
            "hyperframe==6.0.1",
            "idna==2.10",
            "importlib-resources==5.0.7",
            "infoblox-client==0.6.0",
            "iso8601==2.1.0",
            "Jinja2==3.1.2",
            "jsonschema==4.16.0",
            "jxmlease==1.0.3",
            "lockfile==0.12.2",
            "lxml==4.6.5",
            "MarkupSafe==2.1.1",
            "md-toc==9.0.0",
            "msgpack==1.0.8",
            "multidict==6.0.5",
            "mypy-extensions==0.4.3",
            "ncclient==0.6.10",
            "netaddr==1.3.0",
            "netifaces==0.11.0",
            "ntlm-auth==1.5.0",
            "oslo.config==9.5.0",
            "oslo.context==5.5.0",
            "oslo.i18n==6.3.0",
            "oslo.log==6.1.1",
            "oslo.serialization==5.4.0",
            "oslo.utils==7.2.0",
            "packaging==24.1",
            "paramiko==2.8.1",
            "passlib==1.7.4",
            "pathspec==0.9.0",
            "pbr==6.0.0",
            "pexpect==4.8.0",
            "platformdirs==2.4.1",
            "protobuf==5.27.2",
            "psycopg2-binary==2.9.7",
            "ptyprocess==0.6.0",
            "pycparser==2.21",
            "Pygments==2.11.2",
            "pykerberos==1.2.1",
            "pymongo==4.8.0",
            "PyNaCl==1.4.0",
            "pyOpenSSL==23.0.0",
            "pyparsing==3.0.9",
            "pypsrp==0.5.0",
            "pyrsistent==0.18.1",
            "PySocks==1.7.1",
            "pyspnego==0.9.0",
            "python-daemon==2.3.0",
            "python-dateutil==2.9.0.post0",
            "pywinrm==0.4.1",
            "PyYAML==6.0",
            "requests==2.32.3",
            "requests-credssp==2.0.0",
            "requests-ntlm==1.1.0",
            "resolvelib==0.5.4",
            "rfc3986==2.0.0",
            "rich==12.0.0",
            "ruamel.yaml==0.17.21",
            "ruamel.yaml.clib==0.2.6",
            "six==1.16.0",
            "stevedore==5.2.0",
            "subprocess-tee==0.4.1",
            "textfsm==1.1.3",
            "toml==0.10.2",
            "tomli==2.0.1",
            "treelib==1.7.0",
            "ttp==0.9.5",
            "typing-extensions==4.12.2",
            "tzdata==2024.1",
            "urllib3==1.25.10",
            "wcmatch==8.3",
            "wrapt==1.16.0",
            "xmltodict==0.12.0"


This, instead, is the *working* configuration

"Collection            Version",
            "--------------------- -------",
            "community.general     7.3.0  ",
            "",
            "# /usr/share/ansible/collections/ansible_collections",
            "Collection            Version",
            "--------------------- -------",
            "ansible.netcommon     6.1.0  ",
            "ansible.posix         1.5.4  ",
            "ansible.utils         3.0.0  ",
            "arista.avd            4.6.0  ",
            "arista.cvp            3.10.1 ",
            "arista.eos            7.0.0  ",
            "community.mongodb     1.6.3  ",
            "cyberark.pas          1.0.25 ",
            "infoblox.nios_modules 1.4.1  "
			
			
            "ansible-compat==3.0.2",
            "ansible-core==2.15.3",
            "ansible-lint==6.14.3",
            "ansible-pylibssh==1.1.0",
            "ansible-runner==2.3.2",
            "aristaproto==0.1.1",
            "attrs==21.4.0",
            "bcrypt==3.2.0",
            "black==22.8.0",
            "bracex==2.2.1",
            "certifi==2024.2.2",
            "cffi==1.15.0",
            "chardet==3.0.4",
            "charset-normalizer==3.3.2",
            "click==8.1.3",
            "commonmark==0.9.1",
            "cryptography==38.0.4",
            "cvprac==1.3.2",
            "debtcollector==3.0.0",
            "decorator==5.1.1",
            "deepmerge==1.1.1",
            "dnspython==2.6.1",
            "docutils==0.16",
            "filelock==3.8.0",
            "fpyutils==4.0.1",
            "future==0.18.3",
            "grpcio==1.62.2",
            "grpclib==0.4.7",
            "gssapi==1.8.2",
            "h2==4.1.0",
            "hpack==4.0.0",
            "hyperframe==6.0.1",
            "idna==2.10",
            "importlib-resources==5.0.7",
            "infoblox-client==0.6.0",
            "iso8601==2.1.0",
            "Jinja2==3.1.2",
            "jsonschema==4.16.0",
            "jxmlease==1.0.3",
            "lockfile==0.12.2",
            "lxml==4.6.5",
            "MarkupSafe==2.1.1",
            "md-toc==9.0.0",
            "msgpack==1.0.8",
            "multidict==6.0.5",
            "mypy-extensions==0.4.3",
            "ncclient==0.6.10",
            "netaddr==1.2.1",
            "netifaces==0.11.0",
            "ntlm-auth==1.5.0",
            "oslo.config==9.4.0",
            "oslo.context==5.5.0",
            "oslo.i18n==6.3.0",
            "oslo.log==5.5.1",
            "oslo.serialization==5.4.0",
            "oslo.utils==7.1.0",
            "packaging==21.3",
            "paramiko==2.8.1",
            "passlib==1.7.4",
            "pathspec==0.9.0",
            "pbr==6.0.0",
            "pexpect==4.8.0",
            "platformdirs==2.4.1",
            "protobuf==5.26.1",
            "psycopg2-binary==2.9.7",
            "ptyprocess==0.6.0",
            "pycparser==2.21",
            "Pygments==2.11.2",
            "pyinotify==0.9.6",
            "pykerberos==1.2.1",
            "pymongo==4.3.3",
            "PyNaCl==1.4.0",
            "pyOpenSSL==23.0.0",
            "pyparsing==3.0.9",
            "pypsrp==0.5.0",
            "pyrsistent==0.18.1",
            "PySocks==1.7.1",
            "pyspnego==0.9.0",
            "python-daemon==2.3.0",
            "python-dateutil==2.9.0.post0",
            "pywinrm==0.4.1",
            "PyYAML==6.0.1",
            "requests==2.31.0",
            "requests-credssp==2.0.0",
            "requests-ntlm==1.1.0",
            "resolvelib==0.5.4",
            "rfc3986==2.0.0",
            "rich==12.0.0",
            "ruamel.yaml==0.17.21",
            "ruamel.yaml.clib==0.2.6",
            "six==1.16.0",
            "stevedore==5.2.0",
            "subprocess-tee==0.4.1",
            "textfsm==1.1.3",
            "toml==0.10.2",
            "tomli==2.0.1",
            "treelib==1.7.0",
            "ttp==0.9.5",
            "typing-extensions==4.11.0",
            "tzdata==2024.1",
            "urllib3==1.25.10",
            "wcmatch==8.3",
            "wrapt==1.16.0",
            "xmltodict==0.12.0"

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions