Add async_method_call to utility
Adding async_method_call in dbus utility gives us a place where we can
intercept method call requests from dbus to potentially add
logging/caching.
An example of logging is in the later commit:
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/78265/
We already do this for setProperty, this moves the method calls to
follow a similar pattern.
Tested: Redfish service validator passes.
Change-Id: I6d2c96e2b6b6a023ed2138106a55faebca161592
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 645c242..6d69bc9 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -423,7 +423,8 @@
const std::string& service,
const sdbusplus::message::object_path& objectPath)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp,
id{objectPath.filename()}](const boost::system::error_code& ec) {
if (ec)
@@ -610,7 +611,8 @@
std::shared_ptr<CertificateFile> certFile =
std::make_shared<CertificateFile>(certificate);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, certFile, objectPath, service, url{*parsedUrl}, id, name,
certificate](const boost::system::error_code& ec,
sdbusplus::message_t& m) {
@@ -656,7 +658,8 @@
{
BMCWEB_LOG_DEBUG("getCSR CertObjectPath{} CSRObjectPath={} service={}",
certObjPath, csrObjPath, service);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp,
certURI](const boost::system::error_code& ec, const std::string& csr) {
if (ec)
@@ -900,7 +903,8 @@
}
}
});
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp](const boost::system::error_code& ec, const std::string&) {
if (ec)
{
@@ -1007,7 +1011,8 @@
std::shared_ptr<CertificateFile> certFile =
std::make_shared<CertificateFile>(certHttpBody);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, certFile](const boost::system::error_code& ec,
const std::string& objectPath) {
if (ec)
@@ -1122,7 +1127,8 @@
std::shared_ptr<CertificateFile> certFile =
std::make_shared<CertificateFile>(certHttpBody);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, certFile](const boost::system::error_code& ec,
const std::string& objectPath) {
if (ec)
@@ -1260,7 +1266,8 @@
std::shared_ptr<CertificateFile> certFile =
std::make_shared<CertificateFile>(certHttpBody);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, certFile](const boost::system::error_code& ec,
const std::string& objectPath) {
if (ec)