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/account_service.hpp b/redfish-core/lib/account_service.hpp
index d7f686c..63c51a8 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -9,7 +9,6 @@
#include "async_resp.hpp"
#include "boost_formatters.hpp"
#include "certificate_service.hpp"
-#include "dbus_singleton.hpp"
#include "dbus_utility.hpp"
#include "error_messages.hpp"
#include "generated/enums/account_service.hpp"
@@ -392,7 +391,8 @@
// delete the existing object
if (index < roleMapObjData.size())
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, roleMapObjData, serverType,
index](const boost::system::error_code& ec) {
if (ec)
@@ -506,7 +506,8 @@
BMCWEB_LOG_DEBUG("Remote Group={},LocalRole={}", *remoteGroup,
*localRole);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, serverType, localRole,
remoteGroup](const boost::system::error_code& ec) {
if (ec)
@@ -1820,7 +1821,8 @@
tempObjPath /= username;
const std::string userPath(tempObjPath);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, password](const boost::system::error_code& ec3) {
if (ec3)
{
@@ -1912,7 +1914,8 @@
messages::internalError(asyncResp->res);
return;
}
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, username, password](const boost::system::error_code& ec2,
sdbusplus::message_t& m) {
processAfterCreateUser(asyncResp, username, password, ec2, m);
@@ -2191,7 +2194,8 @@
tempObjPath /= username;
const std::string userPath(tempObjPath);
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, username](const boost::system::error_code& ec) {
if (ec)
{
@@ -2285,7 +2289,8 @@
locked, accountTypes, userSelf, req.session);
return;
}
- crow::connections::systemBus->async_method_call(
+ dbus::utility::async_method_call(
+ asyncResp,
[asyncResp, username, password(std::move(password)),
roleId(std::move(roleId)), enabled, newUser{std::string(*newUserName)},
locked, userSelf, session = req.session,