Fix unable to find sensor object
This is due to MemberId is the combination of sensorType+sensorName,
and we only extract sensorName from objectsWithConnection.
Therefore, prepend the sensorType to prevent this from occuring.
Tested: code complies, and confirmed via curl, function works.
Change-Id: Ic76607576475547030b9556a64c902e560aabf5d
Signed-off-by: Ban Feng <kcfeng0@nuvoton.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 4969c8f..5bd846d 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -2682,8 +2682,12 @@
messages::internalError(sensorAsyncResp->asyncResp->res);
return;
}
+ std::string id = path.parent_path().filename();
+ id.erase(std::remove(id.begin(), id.end(), '_'), id.end());
+ id += "_";
+ id += sensorName;
- const auto& iterator = overrideMap.find(sensorName);
+ const auto& iterator = overrideMap.find(id);
if (iterator == overrideMap.end())
{
BMCWEB_LOG_INFO("Unable to find sensor object{}",