Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxos_vlans: invalid syntax (<unknown>, line 1) #826

Open
drobnymichal opened this issue Mar 4, 2024 · 2 comments
Open

nxos_vlans: invalid syntax (<unknown>, line 1) #826

drobnymichal opened this issue Mar 4, 2024 · 2 comments
Assignees
Labels
needs_info This issue requires further information. Please answer any outstanding questions.

Comments

@drobnymichal
Copy link

SUMMARY

I am using nxos_vlans module for vlans deployment. However, the task returns the error mentioned below. I tried changing the version of this library (3.0, 4.4.0,5.3.0), but without success. I also tried Python 3.10 and Python 3.9 - same behavior.

This switch works fine:

Software
  BIOS: version 01.11
  NXOS: version 10.2(6) [Maintenance Release]

Hardware
  cisco Nexus9000 C9332D-GX2B Chassis 
  Intel(R) Xeon(R) CPU D-1633N @ 2.50GHz with 32811780 kB of memory.

This switch raises the described error:

Software
  BIOS: version 05.40
  NXOS: version 9.3(3)

Hardware
  cisco Nexus9000 C93108TC-FX Chassis 
  Intel(R) Xeon(R) CPU D-1526 @ 1.80GHz with 24570436 kB of memory.
ISSUE TYPE
  • Bug Report
COMPONENT NAME

nxos_vlans

ANSIBLE VERSION
ansible [core 2.16.4]
  config file = /home/user/projects/vlans/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.local/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection Version
---------- -------
cisco.nxos 5.3.0  
CONFIGURATION
None
OS / ENVIRONMENT

PC: Ubuntu 22.04
switch:

Software
  BIOS: version 05.40
 NXOS: version 9.3(3)

Hardware
  cisco Nexus9000 C93108TC-FX Chassis 
  Intel(R) Xeon(R) CPU D-1526 @ 1.80GHz with 24570436 kB of memory.
STEPS TO REPRODUCE
- name: Gather Vlans from NXOS
  cisco.nxos.nxos_vlans:
    state: gathered
EXPECTED RESULTS

Return or push VLANS from/to the device.

ACTUAL RESULTS

The task will terminate with the error below. I have tried other states, such as merged or replaced. It always ends with the error.

The full traceback is:
  File "/home/user/.ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 128, in get_network_resources_facts
    inst.populate_facts(self._connection, self.ansible_facts, data)
  File "/home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/vlans/vlans.py", line 89, in populate_facts
    data = self.normalize_table_data(structured, run_cfg_output)
  File "/home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/vlans/vlans.py", line 153, in normalize_table_data
    structured = ast.literal_eval(str(structured))
  File "/usr/lib/python3.10/ast.py", line 64, in literal_eval
    node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
  File "/usr/lib/python3.10/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
fatal: [switch]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "config": null,
            "running_config": null,
            "state": "gathered"
        }
    },
    "msg": "invalid syntax (<unknown>, line 1)"
}
@NilashishC NilashishC self-assigned this Mar 6, 2024
@juhnny5
Copy link

juhnny5 commented May 5, 2024

Hello, I'm experiencing exactly the same problem on a Cisco Nexus 5k.

@NilashishC NilashishC added the needs_info This issue requires further information. Please answer any outstanding questions. label Jun 6, 2024
@NilashishC
Copy link
Collaborator

@drobnymichal Can you please share the output of show running-config | section ^vlan and show vlan | json-pretty from the target appliance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_info This issue requires further information. Please answer any outstanding questions.
Projects
None yet
Development

No branches or pull requests

3 participants