diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py index fddb620021..f48624f6c1 100644 --- a/lib/ansible/module_utils/redfish_utils.py +++ b/lib/ansible/module_utils/redfish_utils.py @@ -903,7 +903,7 @@ class RedfishUtils(object): def get_multi_cpu_inventory(self): return self.aggregate(self.get_cpu_inventory) - def get_nic_inventory(self, resource_type, systems_uri): + def get_nic_inventory(self, resource_uri): result = {} nic_list = [] nic_results = [] @@ -913,12 +913,6 @@ class RedfishUtils(object): 'NameServers', 'PermanentMACAddress', 'SpeedMbps', 'MTUSize', 'AutoNeg', 'Status'] - # Given resource_type, use the proper URI - if resource_type == 'Systems': - resource_uri = systems_uri - elif resource_type == 'Manager': - resource_uri = self.manager_uri - response = self.get_request(self.root_uri + resource_uri) if response['ret'] is False: return response @@ -959,11 +953,19 @@ class RedfishUtils(object): def get_multi_nic_inventory(self, resource_type): ret = True entries = [] - for systems_uri in self.systems_uris: - inventory = self.get_nic_inventory(resource_type, systems_uri) + + # Given resource_type, use the proper URI + if resource_type == 'Systems': + resource_uris = self.systems_uris + elif resource_type == 'Manager': + # put in a list to match what we're doing with systems_uris + resource_uris = [self.manager_uri] + + for resource_uri in resource_uris: + inventory = self.get_nic_inventory(resource_uri) ret = inventory.pop('ret') and ret if 'entries' in inventory: - entries.append(({'systems_uri': systems_uri}, + entries.append(({'resource_uri': resource_uri}, inventory['entries'])) return dict(ret=ret, entries=entries) diff --git a/lib/ansible/modules/remote_management/redfish/redfish_facts.py b/lib/ansible/modules/remote_management/redfish/redfish_facts.py index 9330d1711e..6ed6672789 100644 --- a/lib/ansible/modules/remote_management/redfish/redfish_facts.py +++ b/lib/ansible/modules/remote_management/redfish/redfish_facts.py @@ -289,7 +289,7 @@ def main(): for command in command_list: if command == "GetManagerNicInventory": - result["manager_nics"] = rf_utils.get_multi_nic_inventory(resource_type=category) + result["manager_nics"] = rf_utils.get_multi_nic_inventory(category) elif command == "GetLogs": result["log"] = rf_utils.get_logs()