error with re.compile in cisco.nxos.nxos_command module
gaetanquentin opened this issue · 3 comments
SUMMARY
error with re.compile in cisco.nxos.nxos_command module
ISSUE TYPE
- Bug Report
COMPONENT NAME
cisco.nxos.nxos_command:
ANSIBLE VERSION
ansible 2.9.25
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/myaccount/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Mar 20 2020, 17:08:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
COLLECTION VERSION
collection list command not supported in ansible 2.9.
giving information manualy:
{
"collection_info": {
"namespace": "cisco",
"name": "nxos",
"version": "2.9.1",
"authors": [
"Ansible Network Community (ansible-network)"
],
"readme": "README.md",
"tags": [
"cisco",
"nxos",
"networking",
"nxapi",
"netconf"
],
"description": "Ansible Network Collection for Cisco NXOS devices.",
"license": [],
"license_file": "LICENSE",
"dependencies": {
"ansible.netcommon": ">=2.0.1"
},
"repository": "https://github.com/ansible-collections/cisco.nxos",
"documentation": null,
"homepage": null,
"issues": "https://github.com/ansible-collections/cisco.nxos/issues"
},
"file_manifest_file": {
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "93a512bc30614000c2afb4f487a563578ff9bc5afb787dcbe666577d79e46b23",
"format": 1
},
"format": 1
}
CONFIGURATION
ansible-config-dump: command not found
ansible-config:
ansible_network_os: cisco.nxos.nxos
ansible_connection: ansible.netcommon.network_cli
persistent_log_messages: true
OS / ENVIRONMENT
ansible controler os version:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 7.6 (Maipo)
Release: 7.6
Codename: Maipo
device version:
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_series_home.html
Copyright (c) 2002-2019, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under
license. Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or the GNU
Lesser General Public License (LGPL) Version 2.1. A copy of each
such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://www.opensource.org/licenses/lgpl-2.1.php
Software
BIOS: version 3.1.0
kickstart: version 7.3(4)D1(1)
system: version 7.3(4)D1(1)
BIOS compile time: 02/27/2013
kickstart image file is: bootflash:///n7700-s2-kickstart.7.3.4.D1.1.bin
kickstart compile time: 5/13/2019 23:00:00 [05/15/2019 13:58:17]
system image file is: bootflash:///n7700-s2-dk9.7.3.4.D1.1.bin
system compile time: 5/13/2019 23:00:00 [05/15/2019 15:48:43]
Hardware
cisco Nexus7700 C7706 (6 Slot) Chassis ("Supervisor Module-2")
Intel(R) Xeon(R) CPU with 32940104 kB of memory.
Processor Board ID JAE20260EZV
Device name: MYDEVICE
bootflash: 3932160 kB
slot0: 0 kB (expansion flash)
Kernel uptime is 25 day(s), 2 hour(s), 38 minute(s), 21 second(s)
Last reset
Reason: Unknown
System version: 7.3(4)D1(1)
Service:
plugin
Core Plugin, Ethernet Plugin
Active Package(s)
STEPS TO REPRODUCE
playbook and role:
playbook:
- hosts: network_cisco_nxos
gather_facts: false
roles:
- ../roles/network/cisco-nxos
role:
- name: run multiple commands on remote nodes
cisco.nxos.nxos_command:
commands:
- show version
- show interfaces
tags:
- netcli-collection-nxos
EXPECTED RESULTS
command results
ACTUAL RESULTS
2022-04-22 10:32:44,663 p=36529 u=myaccountn=ansible | TASK [../roles/network/cisco-nxos : run multiple commands on remote nodes] ***************************************************************************************************************************************************************
2022-04-22 10:32:44,820 p=36529 u=myaccountn=ansible | The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 147, in run
res = self._execute()
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 620, in _execute
self._connection = self._get_connection(cvars, templar)
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 913, in _get_connection
ansible_playbook_pid=to_text(os.getppid())
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 573, in get
obj = obj(*args, **kwargs)
File "/home/w23960p/.ansible/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py", line 380, in __init__
self._terminal = terminal_loader.get(self._network_os, self)
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 552, in get
self._module_cache[path] = self._load_module_source(name, path)
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 530, in _load_module_source
module = imp.load_source(to_native(full_name), to_native(path), module_file)
File "/home/w23960p/.ansible/collections/ansible_collections/cisco/nxos/plugins/terminal/nxos.py", line 35
rb"[\r\n](?!\s*<)?(\x1b\S+)*[a-zA-Z_0-9]{1}[a-zA-Z0-9-_.]*[>|#](?:\s*)(\x1b\S+)*$"
^
SyntaxError: invalid syntax
2022-04-22 10:32:44,821 p=36529 u=myaccountn=ansible | fatal: [mydevice]: FAILED! => {
"msg": "Unexpected failure during module execution.",
"stdout": ""
Hello @gaetanquentin! The cisco.nxos collection has dropped support for Python 2.7 and it looks like you're running Python 2.7.5. Please upgrade to Python 3.6 or higher to fully leverage the plugins in this collection. If you have further questions, please feel free to reach out to us at any of the communication channels mentioned here https://docs.ansible.com/ansible/latest/community/communication.html. Thank you!
@NilashishC hi, where is it written in the documentation?
ok so with python 3.6.8 it is working.