diff options
Diffstat (limited to 'redfish-core/lib/chassis.hpp')
-rw-r--r-- | redfish-core/lib/chassis.hpp | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index 02bd7a43af..6038384201 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -798,36 +798,6 @@ inline void requestRoutesChassis(App& app) std::bind_front(handleChassisPatch, std::ref(app))); } -/** - * Handle error responses from d-bus for chassis power cycles - */ -inline void handleChassisPowerCycleError(const boost::system::error_code& ec, - const sdbusplus::message_t& eMsg, - crow::Response& res) -{ - if (eMsg.get_error() == nullptr) - { - BMCWEB_LOG_ERROR("D-Bus response error: {}", ec); - messages::internalError(res); - return; - } - std::string_view errorMessage = eMsg.get_error()->name; - - // If operation failed due to BMC not being in Ready state, tell - // user to retry in a bit - if (errorMessage == - std::string_view("xyz.openbmc_project.State.Chassis.Error.BMCNotReady")) - { - BMCWEB_LOG_DEBUG("BMC not ready, operation not allowed right now"); - messages::serviceTemporarilyUnavailable(res, "10"); - return; - } - - BMCWEB_LOG_ERROR("Chassis Power Cycle fail {} sdbusplus:{}", ec, - errorMessage); - messages::internalError(res); -} - inline void doChassisPowerCycle(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { @@ -863,21 +833,8 @@ inline void objectPath = "/xyz/openbmc_project/state/chassis0"; } - sdbusplus::asio::setProperty( - *crow::connections::systemBus, processName, objectPath, - interfaceName, destProperty, propertyValue, - [asyncResp](const boost::system::error_code& ec2, - sdbusplus::message_t& sdbusErrMsg) { - // Use "Set" method to set the property value. - if (ec2) - { - handleChassisPowerCycleError(ec2, sdbusErrMsg, asyncResp->res); - - return; - } - - messages::success(asyncResp->res); - }); + setDbusProperty(asyncResp, processName, objectPath, interfaceName, + destProperty, "ResetType", propertyValue); }); } |