From 95bdb5f061023498a4390f17d436517d4be32b29 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Fri, 27 Oct 2023 10:38:03 -0700 Subject: Break out retrieveUriToDbusMap Change-Id: I7c01c9e455b077348ceb67e524158f997fb0c6cf Signed-off-by: Ed Tanous --- redfish-core/lib/metric_report_definition.hpp | 33 +++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp index 9812fceb70..6ad9f117d2 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp @@ -1223,6 +1223,22 @@ inline void } } // namespace telemetry +inline void afterRetrieveUriToDbusMap( + const std::shared_ptr& /*asyncResp*/, + const std::shared_ptr& addReportReq, + const boost::beast::http::status status, + const std::map& uriToDbus) +{ + if (status != boost::beast::http::status::ok) + { + BMCWEB_LOG_ERROR( + "Failed to retrieve URI to dbus sensors map with err {}", + static_cast(status)); + return; + } + addReportReq->insert(uriToDbus); +} + inline void handleMetricReportDefinitionsPost( App& app, const crow::Request& req, const std::shared_ptr& asyncResp) @@ -1250,20 +1266,9 @@ inline void handleMetricReportDefinitionsPost( asyncResp); for (const auto& [chassis, sensorType] : chassisSensors) { - retrieveUriToDbusMap( - chassis, sensorType, - [asyncResp, addReportReq]( - const boost::beast::http::status status, - const std::map& uriToDbus) { - if (status != boost::beast::http::status::ok) - { - BMCWEB_LOG_ERROR( - "Failed to retrieve URI to dbus sensors map with err {}", - static_cast(status)); - return; - } - addReportReq->insert(uriToDbus); - }); + retrieveUriToDbusMap(chassis, sensorType, + std::bind_front(afterRetrieveUriToDbusMap, + asyncResp, addReportReq)); } } -- cgit v1.2.3