netascode / ansible-dc-vxlan

Ansible Collection for configuring a VXLAN Fabric using Direct to Controller (DTC) or Direct To Device (DTD) workflows.
https://galaxy.ansible.com/ui/repo/published/cisco/nac_dc_vxlan/
MIT License
6 stars 7 forks source link

Add rule to ensure vxlan.global.name is defined #212

Open mikewiebe opened 1 day ago

mikewiebe commented 1 day ago

Ansible Version

ansible [core 2.16.5]
  config file = /Users/mwiebe/Projects/Ansible/nac-vxlan/ansible.cfg
  configured module search path = ['/Users/mwiebe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mwiebe/.pyenv/versions/3.10.10/envs/ansible_3_10_10/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections
  executable location = /Users/mwiebe/.pyenv/versions/ansible_3_10_10/bin/ansible
  python version = 3.10.10 (main, Mar 28 2023, 08:48:46) [Clang 14.0.0 (clang-1400.0.29.202)] (/Users/mwiebe/.pyenv/versions/3.10.10/envs/ansible_3_10_10/bin/python3.10)
  jinja version = 3.1.3
  libyaml = True

Ansible Collection Versions

Collection                               Version
---------------------------------------- -------
ansible.netcommon                        5.3.0  
ansible.posix                            1.5.4  
ansible.utils                            2.11.0 
cisco.dcnm                               3.5.1  
cisco.nac_dc_vxlan                       0.2.0  
cisco.nxos                               5.3.0  
community.general                        8.5.0

Cisco NDFC Version

12.1.3b

Cisco NX-OS Version

10.4(1)

Which role is this issue related to?

cisco.nac_dc_vxlan.validate

Which section of the data model is this issue related to?

vxlan.global

Expected Behavior

If the user provides data under vxlan.global but fails to specify the name or does not provide any data for vxlan.global the playbook should fail indicating the name is mandatory.

Actual Behavior

If the user does provide data under `vxlan.global` but does not specify the `name` parameter the schema will detect it and fail since it's mandatory in the schema.

If no data is provided under `vxlan.global` the schema check is ignored and the first plugin that tries to access `vxlan.global` fails with the error below.

TASK [cisco.nac_dc_vxlan.validate : Read Run Map From Previous Run] ***********************************************************************************************
Wednesday 30 October 2024  16:48:14 -0400 (0:00:00.013)       0:00:02.179 ***** 
Wednesday 30 October 2024  16:48:14 -0400 (0:00:00.013)       0:00:02.179 ***** 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'global'
fatal: [nac-ndfc1 -> localhost]: FAILED! => {"msg": "Unexpected failure during module execution: 'global'", "stdout": ""}

Ansible Playbook

Run validate role without vxlan.global data

Steps to Reproduce

Run validate role without vxlan.global data

Relevant Debug Output

TASK [cisco.nac_dc_vxlan.validate : Read Run Map From Previous Run] ***********************************************************************************************
Wednesday 30 October 2024  16:48:14 -0400 (0:00:00.013)       0:00:02.179 ***** 
Wednesday 30 October 2024  16:48:14 -0400 (0:00:00.013)       0:00:02.179 ***** 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'global'
fatal: [nac-ndfc1 -> localhost]: FAILED! => {"msg": "Unexpected failure during module execution: 'global'", "stdout": ""}
juburnet commented 11 hours ago

Some users will run without schema and not have validation.