summaryrefslogtreecommitdiff
path: root/include/openbmc_dbus_rest.hpp
diff options
context:
space:
mode:
authorGeorge Liu <liuxiwei@inspur.com>2022-12-07 11:03:22 +0300
committerGeorge Liu <liuxiwei@inspur.com>2023-01-11 04:10:26 +0300
commit7a1dbc4803bf78bfc0c574e6676b3c5def4cdae3 (patch)
tree9d4713a0125046d112ce3eae7053364ddb2c1d26 /include/openbmc_dbus_rest.hpp
parent1f2a40ce3223e024d510f2e3b32fbc7e08012728 (diff)
downloadbmcweb-7a1dbc4803bf78bfc0c574e6676b3c5def4cdae3.tar.xz
Refactor GetSubTreePaths method
Since the GetSubTreePaths method has been implemented in dbus_utility and this commit is to integrate all the places where the GetSubTreePaths method is called, and use the method in dbus_utility uniformly. Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to build. Tested: Redfish Validator Passed Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9
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 2cb2bc335e..c7dbb27c4e 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -13,6 +13,7 @@
// limitations under the License.
#pragma once
+#include "dbus_utility.hpp"
#include "http_request.hpp"
#include "http_response.hpp"
#include "logging.hpp"
@@ -1640,9 +1641,10 @@ inline void handleDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
inline void handleList(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& objectPath, int32_t depth = 0)
{
- crow::connections::systemBus->async_method_call(
+ dbus::utility::getSubTreePaths(
+ objectPath, depth, {},
[asyncResp](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse& objectPaths) {
if (ec)
{
@@ -1656,11 +1658,7 @@ inline void handleList(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
asyncResp->res.jsonValue["message"] = "200 OK";
asyncResp->res.jsonValue["data"] = objectPaths;
}
- },
- "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", objectPath,
- depth, std::array<std::string, 0>());
+ });
}
inline void handleEnumerate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,