1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 18:21:14 +00:00

hwmon: Added allowed values to sensors parameter

Previously the sensor name was just appeneded to the end of the
previous sensors name.
This commit is contained in:
Sebastian Goscik 2016-05-06 13:52:38 +01:00
parent ef61f16896
commit 87cbce4244

View File

@ -64,6 +64,7 @@ class HwmonInstrument(Instrument):
parameters = [ parameters = [
Parameter('sensors', kind=list_of_strs, default=['energy', 'temp'], Parameter('sensors', kind=list_of_strs, default=['energy', 'temp'],
global_alias='hwmon_sensors', global_alias='hwmon_sensors',
allowed_values=HWMON_SENSORS.keys(),
description='The kinds of sensors hwmon instrument will look for') description='The kinds of sensors hwmon instrument will look for')
] ]
@ -73,11 +74,7 @@ class HwmonInstrument(Instrument):
if self.sensors: if self.sensors:
self.sensor_kinds = {} self.sensor_kinds = {}
for kind in self.sensors: for kind in self.sensors:
if kind in HWMON_SENSORS: self.sensor_kinds[kind] = HWMON_SENSORS[kind]
self.sensor_kinds[kind] = HWMON_SENSORS[kind]
else:
message = 'Unexpected sensor type: {}; must be in {}'.format(kind, HWMON_SENSORS.keys())
raise ConfigError(message)
else: else:
self.sensor_kinds = HWMON_SENSORS self.sensor_kinds = HWMON_SENSORS