Fix threshold parsing logic of CPU sensors
This commit fixes threshold parsing logic of CPU sensors to make
a sensor can be registered even in case there is no threshold
setting.
Change-Id: I95641fb37472b65e8bf70925605b41c66bdad60f
Signed-off-by: Yoo, Jae Hyun <jae.hyun.yoo@intel.com>
diff --git a/sensors/src/CPUSensorMain.cpp b/sensors/src/CPUSensorMain.cpp
index d6d68ad..80f3f1c 100644
--- a/sensors/src/CPUSensorMain.cpp
+++ b/sensors/src/CPUSensorMain.cpp
@@ -212,17 +212,15 @@
std::string sensorName = label + " CPU" + std::to_string(cpuId);
std::vector<thresholds::Threshold> sensorThresholds;
std::string labelHead = label.substr(0, label.find(" "));
- if (!ParseThresholdsFromConfig(*sensorData, sensorThresholds,
- &labelHead))
- {
- continue;
- }
+ ParseThresholdsFromConfig(*sensorData, sensorThresholds,
+ &labelHead);
if (!sensorThresholds.size())
{
if (!ParseThresholdsFromAttr(sensorThresholds, inputPathStr,
CPUSensor::SENSOR_SCALE_FACTOR))
{
- continue;
+ std::cerr << "error populating thresholds for "
+ << sensorName << "\n";
}
}
sensors[sensorName] = std::make_unique<CPUSensor>(