Move to Redfish setProperty call
This commit changes sdbusplus setProperty calls (in various files) to
setDbusProperty method in Redfish namespace that handles all DBus
errors in a consistent manner.
It also handles and translates additional DBus errors to Redfish
specific errors in dbus_utils file.
Tested By:
Not tested yet
Change-Id: If440774879413754f4c24f9b6572c3c9fa1fd033
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index baf9235..c310e3f 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -138,20 +138,12 @@
ledOn = true;
}
}
- sdbusplus::asio::setProperty(
- *crow::connections::systemBus,
- "xyz.openbmc_project.LED.GroupManager",
- "/xyz/openbmc_project/led/groups/enclosure_identify",
- "xyz.openbmc_project.Led.Group", "Asserted", ledBlinkng,
- [asyncResp](const boost::system::error_code& ec2) {
- if (ec2)
- {
- BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
- messages::internalError(asyncResp->res);
- return;
- }
- messages::success(asyncResp->res);
- });
+ setDbusProperty(
+ asyncResp, "xyz.openbmc_project.LED.GroupManager",
+ sdbusplus::message::object_path(
+ "/xyz/openbmc_project/led/groups/enclosure_identify"),
+ "xyz.openbmc_project.Led.Group", "Asserted", "IndicatorLED",
+ ledBlinkng);
});
}
@@ -236,19 +228,12 @@
// Some systems may not have enclosure_identify_blink object so
// lets set enclosure_identify state also if
// enclosure_identify_blink failed
- sdbusplus::asio::setProperty(
- *crow::connections::systemBus,
- "xyz.openbmc_project.LED.GroupManager",
- "/xyz/openbmc_project/led/groups/enclosure_identify",
- "xyz.openbmc_project.Led.Group", "Asserted", ledState,
- [asyncResp](const boost::system::error_code& ec2) {
- if (ec2)
- {
- BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
- messages::internalError(asyncResp->res);
- return;
- }
- });
+ setDbusProperty(
+ asyncResp, "xyz.openbmc_project.LED.GroupManager",
+ sdbusplus::message::object_path(
+ "/xyz/openbmc_project/led/groups/enclosure_identify"),
+ "xyz.openbmc_project.Led.Group", "Asserted",
+ "LocationIndicatorActive", ledState);
}
});
}