Fix Regression in PATCH on system node
Commit d573bb2a regressed the PATCH operation
on the system redfish node. By initializing
result to no_content, the commit broke the subsequent
json_util::readJson, which checks if the result is "ok"
at the end of the function.
This commit fixes it by making readJsonValues() and its
descendants return a bool status. readJson() no longer
relies on the response object result to indicate success/
failure.
Tested:
-- Verified that PATCH operations on the system node now work.
-- Verified PATCH operations work on manager, accountservice and
ethernetinterfaces nodes.
-- No new errors from the Redfish validator.
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: I54080392297a8f0276161da8b48d8f9518cbdcfe
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index c092379..038387c 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1453,13 +1453,14 @@
{
std::optional<std::string> indicatorLed;
std::optional<nlohmann::json> bootProps;
- if (!json_util::readJson(req, res, "IndicatorLED", indicatorLed, "Boot",
- bootProps))
+ auto asyncResp = std::make_shared<AsyncResp>(res);
+
+ if (!json_util::readJson(req, asyncResp->res, "IndicatorLED",
+ indicatorLed, "Boot", bootProps))
{
return;
}
- auto asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.result(boost::beast::http::status::no_content);
if (bootProps)