Fixes in System schema PATCH handling
-- Fixed typo: "IndicatorLed" ==> "IndicatorLED"
-- Fixed readJson call which was taking in an empty std::string
This caused PATCH to send back a warning if Indicator LED was
missing from the incoming JSON.
-- Fixed a segfault due to accessing an invalid shared_ptr
(The shared_ptr being accessed was previously moved to an async
callback)
Tested:
-- Limited testing done. I tried PATCH'ing the IndicatorLED property
on QEMU.
-- Made sure no segfault anymore.
Change-Id: If47dbacdeee791dd3cc2ac0e37c0b74bb3920df0
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index b6c0512..0b47c09 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -678,9 +678,8 @@
void doPatch(crow::Response &res, const crow::Request &req,
const std::vector<std::string> ¶ms) override
{
- std::string indicatorLedTemp;
- std::optional<std::string> indicatorLed = indicatorLedTemp;
- if (!json_util::readJson(req, res, "IndicatorLed", indicatorLed))
+ std::optional<std::string> indicatorLed;
+ if (!json_util::readJson(req, res, "IndicatorLED", indicatorLed))
{
return;
}
@@ -715,8 +714,7 @@
// Update led group
BMCWEB_LOG_DEBUG << "Update led group.";
crow::connections::systemBus->async_method_call(
- [asyncResp{std::move(asyncResp)}](
- const boost::system::error_code ec) {
+ [asyncResp](const boost::system::error_code ec) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;