2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 19:57:47 +00:00

Fix get_health with a NextScale FPC

There was an oversimplified assumption in play.  Provide
a method to enumerate the generated names as well as
the static names.

Change-Id: I08dbaaafd7c607869d185f57bae0ea70ebf1084e
This commit is contained in:
Jarrod Johnson 2016-04-12 14:12:06 -04:00
parent 14fa128a18
commit a01e705ab7
2 changed files with 13 additions and 1 deletions

View File

@ -299,7 +299,7 @@ class OEMHandler(generic.OEMHandler):
def get_sensor_data(self):
if self.is_fpc:
for name in nextscale.fpc_sensors:
for name in nextscale.get_sensor_names():
yield nextscale.get_sensor_reading(name, self.ipmicmd)
def get_sensor_descriptions(self):

View File

@ -68,6 +68,18 @@ fpc_sensors = {
}
def get_sensor_names():
global fpc_sensors
for name in fpc_sensors:
sensor = fpc_sensors[name]
if 'elements' in sensor:
for elemidx in xrange(sensor['elements']):
elemidx += 1
yield '{0} {1}'.format(name, elemidx)
else:
yield name
def get_sensor_descriptions():
global fpc_sensors
for name in fpc_sensors: