chassis-state: no error in chassis if unavailable
This is similar to commit
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50799
from Andrew Geissler. getChassisState() can fail if the state
information provided by xyz.openbmc_project.State.Chassis service is
unavailable. We want bmcweb to still return the other chassis
information regardless of if that service is running at the time.
Applying that change to chassis allows the majority of the redfish
chassis data to be returned and used by the client.
Tested:
- Verified that when xyz.openbmc_project.State.Chassis was unavailable,
a call to redfish/v1/Chassis/{ChassisId} returned the available
information rather than a 500 error
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: I0446fac5ef362174d5ae2d082e1dc15eaf1c5875
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 7b67380..1984d75 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -46,6 +46,13 @@
const std::string& chassisState) {
if (ec)
{
+ if (ec == boost::system::errc::host_unreachable)
+ {
+ // Service not available, no error, just don't return
+ // chassis state info
+ BMCWEB_LOG_DEBUG << "Service not available " << ec;
+ return;
+ }
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
messages::internalError(aResp->res);
return;