ansible_modules icon indicating copy to clipboard operation
ansible_modules copied to clipboard

[Bug]: netbox.netbox.netbox_cable module causes exceptions on secondary playbook runs

Open TGH-TH opened this issue 1 year ago • 3 comments

Ansible NetBox Collection version

v3.13.0

Ansible version

ansible [core 2.13.5]
  config file = /home/redacted/projects/ansible/NetBox/ansible.cfg
  configured module search path = ['/home/redacted/projects/ansible/NetBox/library']
  ansible python module location = /home/redacted/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/redacted/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.13 (main, Nov 16 2022, 15:31:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]
  jinja version = 3.1.2
  libyaml = True

NetBox version

v3.5.6

Python version

3.9

Steps to Reproduce

Create a cable connecting a dcim.powerport and dcim.poweroutlet endpoints using the netbox.netbox.netbox_cable module. This runs fine and creates the cable however subsequent runs create an exception The error was: Exception: power-ports not found in API_APPS_ENDPOINTS

Additionally a similar albeit slightly different error occurs when doing the same above with dcim.powerfeed and dcim.powerport end points but the error this time is AttributeError: 'dict' object has no attribute 'endpoint'

I can work around this by creating a task before the offending task that deletes the cable first - this allows the second task to create the cable successfully

Expected Behavior

First run should produce a 'changed' task as the cable is created

second (and subsequent) run should produce a green 'not changed' task

Observed Behavior

First run should produce a 'changed' task as the cable is created

second (and subsequent) runs produce an exception Exception: power-ports not found in API_APPS_ENDPOINTS for dcim.powerport and dcim.poweroutlet combos and Exception: AttributeError: 'dict' object has no attribute 'endpoint' for dcim.powerport and dcim.powerfeed combos

playbook fails at this point.

TGH-TH avatar Jul 23 '23 08:07 TGH-TH