CiscoDevNet / ansible-dcnm

Apache License 2.0
47 stars 37 forks source link

handle not found fabric gracefully on dcnm_inventory #168

Closed dsx1123 closed 1 year ago

dsx1123 commented 2 years ago

Community Note

Ansible Version and collection version

ansible [core 2.11.10]
  config file = /root/.ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/virtualenv/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/virtualenv/ansible/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.0.2
  libyaml = True

DCNM version

Affected module(s)

Ansible Playbook

- name: build inventory of fabric {{ fabric.name }}
  dcnm_inventory:
    fabric: "{{ fabric.name }}"
    config: "{{ updated_fabric.fabric.inventory }}"
  tags:
    - inventory
# Copy-paste your anisble playbook here 

Debug Output

Expected Behavior

the fabric in playbook does not exist, it could be topo or fabric is not created yet, the error message should indicate it.

Actual Behavior

Here is the current error message:

TASK [fabric : build inventory of fabric fabric_stage] ****************************************************************************************************************************************************************************************
Monday 03 October 2022  09:50:19 -0700 (0:00:00.593)       0:00:02.372 ********
[WARNING]: Persistent connection logging is enabled for 172.25.74.47. This will log ALL interactions to /tmp/ansible.log and WILL NOT redact sensitive configuration like passwords. USE WITH CAUTION!
fatal: [172.25.74.47]: FAILED! => {"changed": false, "module_stderr": "Unable to decode JSON from response to send_request('GET', '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/fabric_stage', None). Received 'None'.", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"}

Steps to Reproduce

References

mikewiebe commented 1 year ago

Fixed in release https://github.com/CiscoDevNet/ansible-dcnm/releases/tag/3.0.0