From 788088d440e8d105f6e75f664f2b28f79f95f3fe Mon Sep 17 00:00:00 2001 From: Allen Robel Date: Mon, 22 Apr 2024 13:37:09 -1000 Subject: [PATCH] FabricDetails(): Get fabric_name from nvPairs.FABRIC_NAME rather than fabricName, more... Since nvPairs.FABRIC_NAME is documented and fabricName is not, prefer the documented key/value. Also: FabricDetails()._get() - signature in parent class overridden method needs to match that of subclass. FabricDetails()._get_nv_pair() - signature in parent class overridden method needs to match that of subclass. --- plugins/module_utils/fabric/fabric_details.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/fabric/fabric_details.py b/plugins/module_utils/fabric/fabric_details.py index 018a3acfe..2b1f4c963 100644 --- a/plugins/module_utils/fabric/fabric_details.py +++ b/plugins/module_utils/fabric/fabric_details.py @@ -104,7 +104,11 @@ def refresh_super(self): self._update_results() return for item in self.rest_send.response_current.get("DATA"): - self.data[item["fabricName"]] = item + fabric_name = item.get("nvPairs", {}).get("FABRIC_NAME", None) + if fabric_name is None: + self._update_results() + return + self.data[fabric_name] = item msg = f"self.data: {json.dumps(self.data, indent=4, sort_keys=True)}" self.log.debug(msg) @@ -117,12 +121,12 @@ def refresh_super(self): self._update_results() - def _get(self, item=None): + def _get(self, item): """ overridden in subclasses """ - def _get_nv_pair(self, item=None): + def _get_nv_pair(self, item): """ overridden in subclasses """