CiscoDevNet / ansible-pyats

Other
46 stars 12 forks source link

ImportError: No module named genie.libs.parser.utils #11

Closed novolyus closed 4 years ago

novolyus commented 4 years ago

Hi I am receiving this issue when running the playbook with pyats_parse_command

Already installed genie.metaparser without success.

TASK [pyats_parse_command] *** task path: ///nexus/franquezaj/pyats_test.yaml:8 <10.131.177.117> attempting to start connection <10.131.177.117> using connection plugin network_cli <10.131.177.117> local domain socket does not exist, starting it <10.131.177.117> control socket path is /home/dpko.un.org/franquezaj-su/.ansible/pc/174c8aa783 <10.131.177.117> local domain socket listeners started successfully <10.131.177.117> loaded cliconf plugin ios from path /usr/local/lib/python3.6/site-packages/ansible/plugins/cliconf/ios.py for network_os ios <10.131.177.117> <10.131.177.117> local domain socket path is /home/dpko.un.org/franquezaj-su/.ansible/pc/174c8aa783 <10.131.177.117> ESTABLISH LOCAL CONNECTION FOR USER: franquezaj-su <10.131.177.117> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527" && echo ansible-tmp-1594909721.7643833-114462321998527="echo /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527" ) && sleep 0' <10.131.177.117> Attempting python interpreter discovery <10.131.177.117> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0' <10.131.177.117> EXEC /bin/sh -c '/usr/bin/python && sleep 0' Using module file /home/reponeg/nexus/franquezaj/roles/ansible-pyats/library/pyats_parse_command.py <10.131.177.117> PUT /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/tmp1d7xb3e5 TO /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py <10.131.177.117> EXEC /bin/sh -c 'chmod u+x /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/ /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py && sleep 0' <10.131.177.117> EXEC /bin/sh -c '/usr/bin/python /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py && sleep 0' <10.131.177.117> EXEC /bin/sh -c 'rm -f -r /home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py", line 102, in _ansiballz_main() File "/home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py", line 40, in invoke_module runpy.run_module(mod_name='ansible.modules.pyats_parse_command', init_globals=None, run_name='main', alter_sys=True) File "/usr/lib64/python2.7/runpy.py", line 176, in run_module fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/tmp/ansible_pyats_parse_command_payload_zFifX8/ansible_pyats_parse_command_payload.zip/ansible/modules/pyats_parse_command.py", line 16, in ImportError: No module named genie.libs.parser.utils fatal: [10.131.177.117]: FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py\", line 102, in \n _ansiballz_main()\n File \"/home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/dpko.un.org/franquezaj-su/.ansible/tmp/ansible-local-33632kydch6pg/ansible-tmp-1594909721.7643833-114462321998527/AnsiballZ_pyats_parse_command.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.pyats_parse_command', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_pyats_parse_command_payload_zFifX8/ansible_pyats_parse_command_payload.zip/ansible/modules/pyats_parse_command.py\", line 16, in \nImportError: No module named genie.libs.parser.utils\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

novolyus commented 4 years ago

Python interpreter error. Solved

gerardocastaldo commented 4 years ago

I had the same error. The role doesn't import the interpreter if is running in virtualenv.

I resolved the problem configuring the var ansible_python_interpreter: "{{ ansible_playbook_python }}" in playbook.