Skip to content

Commit 3e5a5b2

Browse files
author
=
committed
Handle Dict and Lists in Reponse Data
1 parent cab3d31 commit 3e5a5b2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

plugins/modules/dcnm_vrf.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,11 +4136,19 @@ def handle_response(self, res, op):
41364136
fail = True
41374137
changed = False
41384138
if res.get("DATA"):
4139-
for resp_string in res.get("DATA").values():
4140-
if "fail" in resp_string.lower():
4141-
fail = True
4142-
changed = False
4143-
return fail, changed
4139+
if isinstance(res.get("DATA"), list):
4140+
for resp_data_item in res.get("DATA"):
4141+
for resp_string in resp_data_item.values():
4142+
if "fail" in resp_string.lower():
4143+
fail = True
4144+
changed = False
4145+
return fail, changed
4146+
elif isinstance(res.get("DATA"), dict):
4147+
for resp_string in res.get("DATA").values():
4148+
if "fail" in resp_string.lower():
4149+
fail = True
4150+
changed = False
4151+
return fail, changed
41444152
if op == "attach" and "is in use already" in str(res.values()):
41454153
fail = True
41464154
changed = False

0 commit comments

Comments
 (0)