Fix error handling in system route handler
Skip failing system URI with 500 Internal Error if the service is
unreachable which could occur when the D-Bus service is not available.
Redfish Validator passed for gb200nvl-obmc
Change-Id: I1a746c666aba021532acea1c8f83a73c2279fa3e
Signed-off-by: Aishwary Joshi <aishwaryjoshi31@gmail.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 0301110..e4f02cc 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1181,8 +1181,11 @@
const dbus::utility::DBusPropertiesMap& propertiesList) {
if (ec)
{
- if (ec.value() != EBADR)
+ if (ec.value() != EBADR &&
+ ec.value() != boost::asio::error::host_unreachable)
{
+ // Service not available, no error, just don't return
+ // RebootAttempts information
BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
}
@@ -1237,7 +1240,10 @@
bool autoRebootEnabled) {
if (ec)
{
- if (ec.value() != EBADR)
+ // Service not available, no error, just don't return
+ // AutoReboot information
+ if (ec.value() != EBADR &&
+ ec.value() != boost::asio::error::host_unreachable)
{
BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
@@ -1370,7 +1376,10 @@
[asyncResp](const boost::system::error_code& ec, bool value) {
if (ec)
{
- if (ec.value() != EBADR)
+ // Service not available, no error, just don't return
+ // StopBootOnFault information
+ if (ec.value() != EBADR ||
+ ec.value() != boost::asio::error::host_unreachable)
{
BMCWEB_LOG_ERROR("DBUS response error {}", ec);
messages::internalError(asyncResp->res);