napalm-automation / napalm-ansible

Apache License 2.0
245 stars 103 forks source link

AnsiballZ_napalm_install_config.py Error #208

Open barryconstantly opened 1 month ago

barryconstantly commented 1 month ago

Hello,

This is a Tower question (again). I get this error using napalm_install_config.py, but cannot find the Tower temp file:

Traceback (most recent call last): File "/var/lib/awx/.ansible/tmp/ansible-local-3rxRMUx/ansible-tmp-1720792733.69-31-195727518534311/AnsiballZ_napalm_install_config.py", line 102, in _ansiballz_main()

This is Tower 3.8.6 and ansible 2.9.27.

Any ideas what this error might be (I realize that is broad question..) but more practically how to stop Tower from deleting the temp file so I can inspect?

Thanks, Barry

ktbyers commented 1 month ago

@barryconstantly You need the full exception stack trace...not much we can do with just a line number and a single internal ansible reference (i.e. _ansiballz_main()).

barryconstantly commented 1 month ago

But I cannot find the ansiballz file, I'm pretty sure Tower deletes it

ktbyers commented 1 month ago

Yeah, you need to figure out how to get more information out of Tower regarding the failure (i.e. the full exception stack trace). There is also a way to prevent Ansible from deleting the file.

barryconstantly commented 1 month ago

I followed instructions to prevent deleting files, this worked for many but unfortunately not Ansiballz.

barryconstantly commented 1 month ago

I compared napalm playbook execution with a simple show version playbook (which only uses cisco ios module), and these errors were identical:

File "/usr/local/lib/python3.6/site-packages/selinux/init.py", line 23, in import distro File "/usr/local/lib/python3.6/site-packages/distro/init.py", line 1, in from .distro import ( File "/usr/local/lib/python3.6/site-packages/distro/distro.py", line 40, in from typing import ( File "/var/lib/awx/venv/ansible/lib/python2.7/site-packages/typing.py", line 782, in AnyStr = TypeVar('AnyStr', bytes, unicode) NameError: name 'unicode' is not defined

I think it has something to do with the host OS using Python 3.6 and Tower venv using Python 2.7.

I see some things when I Google that talk about the unicode variable and issues with Python 3 / 2.7, but still trying to determine the solution with Tower

ktbyers commented 1 month ago

Python 2.7 is no longer supported by NAPALM (and many other libraries). Python 3.6 is also end-of-life and likely no longer supported.