CiscoISE / ansible-ise

Official repository for Cisco's Ansible collection for ISE
https://ciscoise.github.io/ansible-ise/
GNU General Public License v3.0
45 stars 12 forks source link

Network_device fails to delete #148

Open markatdxb opened 4 days ago

markatdxb commented 4 days ago

Prerequisites

Name of the module network_device

Describe the bug starting collection 2.9.3 it fails to delete the device, coming with error An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: 'NoneType' object is not iterable fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution: 'NoneType' object is not iterable", "stdout": ""}

Expected behavior Delete device from ISE

Screenshots


- name: Delete device from ISE
      cisco.ise.network_device:
        ise_hostname: "{{ ise_server }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: false
        state: absent
        id: "{{ item_ise_node }}"
      loop: "{{ net_device_id }}"
      loop_control:
        loop_var: item_ise_node

```**Debug**
Enable debugging and add CiscoISE output request and reponse.
* exporting `export ISE_DEBUG=True`
* playbook `ise_debug: True`

**Environment (please complete the following information):**
* ISE version and patch: 
* Ansible version: 9.10.0
* ISE collection version: 2.9.3 and higher
* OS version: 

**Additional context**
Add any other context about the problem here.
fmunozmiranda commented 1 day ago

Hi @markatdxb please share us debug of provider.

markatdxb commented 1 day ago

Hi, i just added debug

- name: Delete device from ISE
      cisco.ise.network_device:
        ise_hostname: "{{ ise_server }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: false
        state: absent
        ise_debug: true
        id: "{{ item_ise_node }}"
      loop: "{{ net_device_id }}"
      loop_control:
        loop_var: **item_ise_node**

result is the same

The full traceback is:
Traceback (most recent call last):
  File "/home/marek/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py", line 120, in run
    item_results = self._run_loop(items)
  File "/home/marek/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py", line 335, in _run_loop
    res = self._execute(variables=task_vars)
  File "/home/marek/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py", line 644, in _execute
    result = self._handler.run(task_vars=vars_copy)
  File "/home/marek/.ansible/collections/ansible_collections/cisco/ise/plugins/action/network_device.py", line 253, in run
    obj = NetworkDevice(self._task.args, ise)
  File "/home/marek/.ansible/collections/ansible_collections/cisco/ise/plugins/action/network_device.py", line 63, in __init__
    for ip in network_device_iplist:
TypeError: 'NoneType' object is not iterable
fatal: [localhost]: FAILED! => {
    "msg": "Unexpected failure during module execution: 'NoneType' object is not iterable",
    "stdout": ""
}

BTW: In documentation of this module is completely missing the option State: