Skip to content

Commit

Permalink
[ignore] Fixed issue in 'aci_config_rollback'. The xml response is no…
Browse files Browse the repository at this point in the history
…w parsed by response_xml function in aci.py when status is not 200
  • Loading branch information
shrsr committed Sep 14, 2023
1 parent d34f2b1 commit 1b3e23b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/module_utils/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def response_xml(self, rawoutput):
self.imdata = xmldata.get("imdata", {}).get("children")
if self.imdata is None:
self.imdata = dict()
self.totalCount = int(xmldata.get("imdata", {}).get("attributes", {}).get("totalCount"))
self.totalCount = int(xmldata.get("imdata", {}).get("attributes", {}).get("totalCount", -1))

# Handle possible APIC error information
self.response_error()
Expand Down
9 changes: 7 additions & 2 deletions plugins/modules/aci_config_rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,13 @@ def get_preview(aci):
except AttributeError:
xml_to_json(aci, info.get("body"))
else:
aci.result["raw"] = info["body"]
aci.fail_json(msg="Request failed: see 'raw' output")
try:
# APIC error
aci.response_xml(info["body"])
aci.fail_json(msg="APIC Error {code}: {text}".format_map(aci.error))
except KeyError:
# Connection error
aci.fail_json(msg="Connection failed for {url}. {msg}".format_map(info))


def xml_to_json(aci, response_data):
Expand Down

0 comments on commit 1b3e23b

Please sign in to comment.