summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAppaRao Puli <apparao.puli@linux.intel.com>2019-11-15 14:57:44 +0530
committerJames Feist <james.feist@linux.intel.com>2019-11-18 09:24:40 -0800
commitf847a198a016c1932177dee62f9a21c6efa6644e (patch)
treeb0db4d8a1db5462fee04ec75eb718ee72738458c
parent7d7034a65cf91e481e74494eec36957ceff573e9 (diff)
downloadbmcweb-f847a198a016c1932177dee62f9a21c6efa6644e.tar.gz
bmcweb-f847a198a016c1932177dee62f9a21c6efa6644e.zip
Fix for IndicatorLED if blinking object not found
Currently some systems doesn't have enclosure_identity_blink object for supporting blinking feature which are leading to systems/system uri failing with 500 error. Corrected the code to make enclosure_identity_blink object get/set as optional. Tested: Tested IndicatorLED for all 3 cases and it works fine. Simulated case to not have enclosure_identity_blink object and teste all 3 InidicatorLED value set and get. Ran the redfish validator with success results. Change-Id: I310fb71269aae6d36ea025556ad3b1d87b0acb39 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com>
-rw-r--r--redfish-core/lib/systems.hpp115
1 files changed, 57 insertions, 58 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 88590ee..4299227 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -566,51 +566,46 @@ void getIndicatorLedState(std::shared_ptr<AsyncResp> aResp)
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
const std::variant<bool> asserted) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
- messages::internalError(aResp->res);
- return;
- }
-
- const bool *blinking = std::get_if<bool>(&asserted);
- if (!blinking)
+ // Some systems may not have enclosure_identify_blink object so
+ // proceed to get enclosure_identify state.
+ if (!ec)
{
- BMCWEB_LOG_DEBUG << "Get identity blinking LED failed";
- messages::internalError(aResp->res);
- return;
- }
- // Blinking ON, no need to check enclosure_identify assert.
- if (*blinking)
- {
- aResp->res.jsonValue["IndicatorLED"] = "Blinking";
- return;
+ const bool *blinking = std::get_if<bool>(&asserted);
+ if (!blinking)
+ {
+ BMCWEB_LOG_DEBUG << "Get identity blinking LED failed";
+ messages::internalError(aResp->res);
+ return;
+ }
+ // Blinking ON, no need to check enclosure_identify assert.
+ if (*blinking)
+ {
+ aResp->res.jsonValue["IndicatorLED"] = "Blinking";
+ return;
+ }
}
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
const std::variant<bool> asserted) {
- if (ec)
+ if (!ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
- messages::internalError(aResp->res);
- return;
- }
-
- const bool *ledOn = std::get_if<bool>(&asserted);
- if (!ledOn)
- {
- BMCWEB_LOG_DEBUG << "Get enclosure identity led failed";
- messages::internalError(aResp->res);
- return;
- }
+ const bool *ledOn = std::get_if<bool>(&asserted);
+ if (!ledOn)
+ {
+ BMCWEB_LOG_DEBUG
+ << "Get enclosure identity led failed";
+ messages::internalError(aResp->res);
+ return;
+ }
- if (*ledOn)
- {
- aResp->res.jsonValue["IndicatorLED"] = "Lit";
- }
- else
- {
- aResp->res.jsonValue["IndicatorLED"] = "Off";
+ if (*ledOn)
+ {
+ aResp->res.jsonValue["IndicatorLED"] = "Lit";
+ }
+ else
+ {
+ aResp->res.jsonValue["IndicatorLED"] = "Off";
+ }
}
return;
},
@@ -654,29 +649,33 @@ void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
}
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::variant<bool> asserted) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
- messages::internalError(aResp->res);
- return;
- }
- },
- "xyz.openbmc_project.LED.GroupManager",
- "/xyz/openbmc_project/led/groups/enclosure_identify",
- "org.freedesktop.DBus.Properties", "Set",
- "xyz.openbmc_project.Led.Group", "Asserted", std::variant<bool>(ledOn));
-
- crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::variant<bool> asserted) {
+ [aResp, ledOn, ledBlinkng](const boost::system::error_code ec,
+ const std::variant<bool> asserted) mutable {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
- messages::internalError(aResp->res);
- return;
+ // Some systems may not have enclosure_identify_blink object so
+ // Lets set enclosure_identify state to true if Blinking is
+ // true.
+ if (ledBlinkng)
+ {
+ ledOn = true;
+ }
}
+ crow::connections::systemBus->async_method_call(
+ [aResp](const boost::system::error_code ec,
+ const std::variant<bool> asserted) {
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ messages::internalError(aResp->res);
+ return;
+ }
+ },
+ "xyz.openbmc_project.LED.GroupManager",
+ "/xyz/openbmc_project/led/groups/enclosure_identify",
+ "org.freedesktop.DBus.Properties", "Set",
+ "xyz.openbmc_project.Led.Group", "Asserted",
+ std::variant<bool>(ledOn));
},
"xyz.openbmc_project.LED.GroupManager",
"/xyz/openbmc_project/led/groups/enclosure_identify_blink",
OpenPOWER on IntegriCloud