Skip to content

Commit

Permalink
fix the chassis url collecting
Browse files Browse the repository at this point in the history
  • Loading branch information
BerndKue committed Oct 18, 2024
1 parent 2b4d7a8 commit a639695
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions redfish_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ def _get_system_urls(self):

server_info = systems['Members'][0]

if not server_info:
logging.warning(" Target %s: No Server Info could be retrieved!", self.target)
return

# Get the server info for the labels
self._urls.update({'Systems': server_info['@odata.id']})

Expand All @@ -323,10 +327,6 @@ def _get_system_urls(self):
'ProcessorSummary'
)

if not server_info:
logging.warning(" Target %s: No Server Info could be retrieved!", self.target)
return

for field in fields:
self._inventory.update({field: server_info.get(field)})

Expand Down Expand Up @@ -385,6 +385,12 @@ def _get_chassis_urls(self):
else:
link = entry['@odata.id']
self._urls[url].append(link)
else:
logging.warning(
" Target %s: No %s URL found in Chassi info!",
self.target,
url
)

def _get_urls(self, url):
urls= []
Expand Down Expand Up @@ -769,8 +775,8 @@ def _get_tpm_info(self):
logging.info(" Target %s: Get the TPM data.", self.target)
systeminfo = self.connect_server(self._urls['Systems'], fields=['TrustedModules'])

tpm_modules = []
if systeminfo and systeminfo.get('TrustedModules'):
tpm_modules = []
for tpm in systeminfo['TrustedModules']:
module_type = tpm.get('InterfaceType')
module_state = tpm.get('Status', {}).get('State', 'Unknown')
Expand Down Expand Up @@ -810,7 +816,7 @@ def collect(self):

# Collect data for different components
self._collect_component_data('Systems', self._get_tpm_info, "TPM")
self._collect_component_data('Chassis', self._get_chassis_urls, "Chassis")
self._collect_component_data('Chassis_Root', self._get_chassis_urls, "Chassis")
self._collect_component_data(
'Storage', self._get_storage_info, "Storage",
('Name', 'Model', 'Manufacturer', 'SerialNumber', 'PartNumber', 'SKU')
Expand Down

0 comments on commit a639695

Please sign in to comment.