Skip to content

Commit

Permalink
[ignore] Modify test case and logic for ndo_port_channel_interface mo…
Browse files Browse the repository at this point in the history
…dule when handling null value.
  • Loading branch information
gmicol committed Dec 11, 2024
1 parent 263ef9a commit 227262d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/ndo_port_channel_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def main():
existing_port_channel_interfaces = mso_template.template.get("fabricResourceTemplate", {}).get("template", {}).get("portChannels", [])
object_description = "Port Channel Interface"

if state in ["query", "absent"] and existing_port_channel_interfaces == []:
if state in ["query", "absent"] and not existing_port_channel_interfaces:
mso.exit_json()
elif state == "query" and not (name or uuid):
mso.existing = existing_port_channel_interfaces
Expand Down Expand Up @@ -361,7 +361,7 @@ def main():

if not module.check_mode and ops:
response = mso.request(mso_template.template_path, method="PATCH", data=ops)
port_channel_interfaces = response.get("fabricResourceTemplate", {}).get("template", {}).get("portChannels", [])
port_channel_interfaces = response.get("fabricResourceTemplate", {}).get("template", {}).get("portChannels", []) or []
match = mso_template.get_object_by_key_value_pairs(
object_description,
port_channel_interfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@
<<: *delete_port_channel_interface
register: nm_delete_port_channel_interface_again

- name: Delete a second port channel interface
cisco.mso.ndo_port_channel_interface:
<<: *create_port_channel_interface_2
state: absent
register: nm_delete_port_channel_interface_2

- name: Assert port channel interface deletion tasks
assert:
that:
Expand All @@ -430,6 +436,9 @@
- nm_delete_port_channel_interface_again is not changed
- nm_delete_port_channel_interface_again.previous == {}
- nm_delete_port_channel_interface_again.current == {}
- nm_delete_port_channel_interface_2 is changed
- nm_delete_port_channel_interface_2.previous.name == "ansible_port_channel_interface_2"
- nm_delete_port_channel_interface_2.current == {}

# ERRORS AND NO PORT CHANNEL INTERFACES FOUND

Expand Down

0 comments on commit 227262d

Please sign in to comment.