Skip to content

Commit

Permalink
log message correction and less exception throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
BerndKue committed Oct 10, 2024
1 parent 8dbb960 commit 4b12ba9
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions redfish_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,18 @@ def _get_system_urls(self):
systems = self.connect_server("/redfish/v1/Systems")

if not systems:
raise CollectorException(
f" Target {self._target}: No Systems Info could be retrieved!"
logging.error(
" Target %s: No Systems Info could be retrieved!",
self._target
)
return

if not systems.get('Members'):
raise CollectorException(
f" Target {self._target}: No Systems Members found!"
logging.error(
" Target %s: No Systems Members found!",
self._target
)
return

# Get the server info for the labels
self._urls.update({'Systems': systems['Members'][0]['@odata.id']})
Expand Down Expand Up @@ -621,7 +625,10 @@ def collect(self):

self._inventory.update({'Drives': drives_updated})
else:
logging.warning(" Target %s: No Drives URL provided! Cannot get drive data!")
logging.warning(
" Target %s: No Drives URL provided! Cannot get drive data!",
self._target
)

# Get the powersupply data
if 'Power' in self._urls:
Expand Down Expand Up @@ -704,7 +711,10 @@ def collect(self):
logging.warning(" Target %s: No Processors found!", self._target)

else:
logging.warning(" Target %s: No Processors URL provided! Cannot get Processors data!")
logging.warning(
" Target %s: No Processors URL provided! Cannot get Processors data!",
self._target
)

# HPE provides the NIC info in the Chassis/PCIeDevices
if 'PCIeDevices' in self._urls:
Expand Down

0 comments on commit 4b12ba9

Please sign in to comment.