summaryrefslogtreecommitdiff
path: root/include/openbmc_dbus_rest.hpp
diff options
context:
space:
mode:
authorGeorge Liu <liuxiwei@inspur.com>2022-12-09 06:06:16 +0300
committerLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-01-24 17:57:43 +0300
commite99073f55f30e2af2c36d7859513ea9464fa647d (patch)
treed3f8b9d0b697717e8c441a6c45f0f72330c21499 /include/openbmc_dbus_rest.hpp
parentc2e320079eeafbc952a6233e31e8a844bbede9ab (diff)
downloadbmcweb-e99073f55f30e2af2c36d7859513ea9464fa647d.tar.xz
Refactor GetSubTree method
Since the GetSubTree method has been implemented in dbus_utility and this commit is to integrate all the places where the GetSubTree method is called, and use the method in dbus_utility uniformly. Tested: Redfish Validator Passed Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: If3852b487d74e7cd8f123e0efffbd4affe92743c
Diffstat (limited to 'include/openbmc_dbus_rest.hpp')
-rw-r--r--include/openbmc_dbus_rest.hpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 948bc367e5..8dd7bb4773 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -34,6 +34,7 @@
#include <boost/container/flat_map.hpp>
#include <boost/container/vector.hpp>
#include <boost/iterator/iterator_facade.hpp>
+#include <boost/system/error_code.hpp>
#include <nlohmann/json.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/property.hpp>
@@ -1660,9 +1661,10 @@ inline void handleEnumerate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
asyncResp->res.jsonValue["status"] = "ok";
asyncResp->res.jsonValue["data"] = nlohmann::json::object();
- crow::connections::systemBus->async_method_call(
+ dbus::utility::getSubTree(
+ objectPath, 0, {},
[objectPath, asyncResp](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& objectNames) {
auto transaction =
std::make_shared<InProgressEnumerateData>(objectPath, asyncResp);
@@ -1684,11 +1686,7 @@ inline void handleEnumerate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
// Add the data for the path passed in to the results
// as if GetSubTree returned it, and continue on enumerating
getObjectAndEnumerate(transaction);
- },
- "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTree", objectPath, 0,
- std::array<const char*, 0>());
+ });
}
inline void handleGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,