From 564e136dc58205cdc19f8e5915d8998cd3b625b9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 4 Feb 2025 09:11:53 -0500 Subject: [PATCH] Always provide a badreadings output, even if empty --- .../confluent/plugins/hardwaremanagement/redfish.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index f89d9a09..c7c5f5d4 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -1186,13 +1186,12 @@ class IpmiHandler(object): health = response['health'] health = _str_health(health) self.output.put(msg.HealthSummary(health, self.node)) - if 'badreadings' in response: - badsensors = [] - for reading in response['badreadings']: - if hasattr(reading, 'health'): - reading.health = _str_health(reading.health) - badsensors.append(reading) - self.output.put(msg.SensorReadings(badsensors, name=self.node)) + badsensors = [] + for reading in response.get('badreadings', []): + if hasattr(reading, 'health'): + reading.health = _str_health(reading.health) + badsensors.append(reading) + self.output.put(msg.SensorReadings(badsensors, name=self.node)) else: raise exc.InvalidArgumentException('health is read-only')