Redfish: Prevent IndicatorLED PATCH from breaking Boot PATCH
Preloading an error into res.result causes the readJson function to
return with that same error. This blocks any PATCH actions on the Boot
array. The PATCH command now responds with an OK response instead of a
Missing Data response.
Tested:
Confirmed the Lit action illuminates the ID LED.
Confirmed the Blinking action causes the ID LED to blink.
Confirmed the Off action turns off the ID LED.
Confirmed Blinking overrides Lit.
Confirmed Lit overrides Blinking.
Confirmed Flashing is returns an error message.
Change-Id: I86104e2a1232f1905a7c54eb00e399b634fa69d3
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 2f2c97f..294698e 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -986,7 +986,7 @@
* @param[in] bootSource The boot source to set.
* @param[in] bootEnable The source override "enable" to set.
*
- * @return None.
+ * @return Integer error code.
*/
static void setBootModeOrSource(std::shared_ptr<AsyncResp> aResp,
bool oneTimeEnabled,
@@ -1167,7 +1167,7 @@
* @param[in] bootSource The boot source from incoming RF request.
* @param[in] bootEnable The boot override enable from incoming RF request.
*
- * @return None.
+ * @return Integer error code.
*/
static void setBootProperties(std::shared_ptr<AsyncResp> aResp,
std::optional<std::string> bootSource,
@@ -1176,7 +1176,7 @@
BMCWEB_LOG_DEBUG << "Set boot information.";
crow::connections::systemBus->async_method_call(
- [aResp{std::move(aResp)}, bootSource{std::move(bootSource)},
+ [aResp, bootSource{std::move(bootSource)},
bootEnable{std::move(bootEnable)}](
const boost::system::error_code ec,
const sdbusplus::message::variant<bool> &oneTime) {
@@ -1550,6 +1550,7 @@
setBootProperties(asyncResp, std::move(bootSource),
std::move(bootEnable));
}
+
if (indicatorLed)
{
std::string dbusLedState;
@@ -1589,16 +1590,13 @@
"org.freedesktop.DBus.Properties", "Set",
"xyz.openbmc_project.Led.Group", "Asserted",
std::variant<bool>(
- (dbusLedState ==
- "xyz.openbmc_project.Led.Physical.Action.Off"
- ? false
- : true)));
+ (dbusLedState !=
+ "xyz.openbmc_project.Led.Physical.Action.Off")));
+
// Update identify led status
BMCWEB_LOG_DEBUG << "Update led SoftwareInventoryCollection.";
crow::connections::systemBus->async_method_call(
- [asyncResp{std::move(asyncResp)},
- indicatorLed{std::move(*indicatorLed)}](
- const boost::system::error_code ec) {
+ [asyncResp](const boost::system::error_code ec) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;