mpenning / ciscoconfparse

Parse, Audit, Query, Build, and Modify Arista / Cisco / Juniper / Palo Alto / F5 configurations.
http://www.pennington.net/py/ciscoconfparse/
GNU General Public License v3.0
789 stars 219 forks source link

[Bug]: ModuleNotFoundError: No module named 'dns' #254

Closed beejaz closed 1 year ago

beejaz commented 1 year ago

Contact Details

Github please

What happened?

Hi,

Using ciscoconfparse 1.6.51 gives current error during our build process now. It worked without problems in 1.6.50, reverting to this version solves the problem for me.

  File "/usr/local/lib/python3.9/site-packages/napalm/base/helpers.py", line 19, in <module>
    from ciscoconfparse import CiscoConfParse
  File "/usr/local/lib/python3.9/site-packages/ciscoconfparse/__init__.py", line 29, in <module>
    from ciscoconfparse.ccp_util import PythonOptimizeCheck
  File "/usr/local/lib/python3.9/site-packages/ciscoconfparse/ccp_util.py", line 39, in <module>
    from dns.exception import DNSException
ModuleNotFoundError: No module named 'dns'

I believe this might be caused by this commit https://github.com/mpenning/ciscoconfparse/commit/3ce2a1dfb67046f8205207b94e8c9fb92a5ad0d4#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L44 that removes these:

dependencies = [
    "passlib=^1.7.4",
    "dnspython=^2.1.0",
    "loguru=0.6.0",
    "toml=0.10.2",
]

CiscoConfParse Version

1.6.51

What Operating System are you using?

Linux - Debian, Ubuntu, CentOS, RHEL or others

What Python version(s) have this problem?

Python 3.9

Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.

Importing package

Python tracebacks

$ python3 tests/verify_templates.py
Traceback (most recent call last):
  File "/builds/ntm/tests/verify_templates.py", line 6, in <module>
    from app.service.ntm import NetworkTemplateManager
  File "/builds/ntm/./app/service/ntm.py", line 13, in <module>
    from app.helpers import nb_initiate, load_yaml_file, MatterMost, napalm_initiate, napalm_merge_config
  File "/builds/ntm/./app/helpers.py", line 5, in <module>
    from napalm import get_network_driver
  File "/usr/local/lib/python3.9/site-packages/napalm/__init__.py", line 3, in <module>
    from napalm.base import get_network_driver
  File "/usr/local/lib/python3.9/site-packages/napalm/base/__init__.py", line 27, in <module>
    from napalm.base.base import NetworkDriver
  File "/usr/local/lib/python3.9/site-packages/napalm/base/base.py", line 25, in <module>
    import napalm.base.helpers
  File "/usr/local/lib/python3.9/site-packages/napalm/base/helpers.py", line 19, in <module>
    from ciscoconfparse import CiscoConfParse
  File "/usr/local/lib/python3.9/site-packages/ciscoconfparse/__init__.py", line 29, in <module>
    from ciscoconfparse.ccp_util import PythonOptimizeCheck
  File "/usr/local/lib/python3.9/site-packages/ciscoconfparse/ccp_util.py", line 39, in <module>
    from dns.exception import DNSException
ModuleNotFoundError: No module named 'dns'

Relevant log output

No response

Code of Conduct

mpenning commented 1 year ago

As you may have seen, I fixed the build problem and added a Github CI test to try to detect this problem after releasing.

Refs:

The next step is building something in my local unittests to do the same.

beejaz commented 1 year ago

Hi, thank you for quick response!

I tried it out with ciscoconfparse-1.6.52 and it worked as it was expected again 👍

Edit: I closed now, maybe that was wrong if you intend to add more checks for future? Sorry.