diff options
author | Ed Tanous <edtanous@google.com> | 2023-10-27 20:38:03 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-11-06 08:48:10 +0300 |
commit | 95bdb5f061023498a4390f17d436517d4be32b29 (patch) | |
tree | 6a7901a9ba4795a922cdfa4c40c2557cfde8458f /redfish-core | |
parent | 06a63974577071c6b4525f7eaeb7dae55b3a7a4d (diff) | |
download | bmcweb-95bdb5f061023498a4390f17d436517d4be32b29.tar.xz |
Break out retrieveUriToDbusMap
Change-Id: I7c01c9e455b077348ceb67e524158f997fb0c6cf
Signed-off-by: Ed Tanous <edtanous@google.com>
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/lib/metric_report_definition.hpp | 33 |
1 files 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<bmcweb::AsyncResp>& /*asyncResp*/, + const std::shared_ptr<telemetry::AddReport>& addReportReq, + const boost::beast::http::status status, + const std::map<std::string, std::string>& uriToDbus) +{ + if (status != boost::beast::http::status::ok) + { + BMCWEB_LOG_ERROR( + "Failed to retrieve URI to dbus sensors map with err {}", + static_cast<unsigned>(status)); + return; + } + addReportReq->insert(uriToDbus); +} + inline void handleMetricReportDefinitionsPost( App& app, const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& 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<std::string, std::string>& uriToDbus) { - if (status != boost::beast::http::status::ok) - { - BMCWEB_LOG_ERROR( - "Failed to retrieve URI to dbus sensors map with err {}", - static_cast<unsigned>(status)); - return; - } - addReportReq->insert(uriToDbus); - }); + retrieveUriToDbusMap(chassis, sensorType, + std::bind_front(afterRetrieveUriToDbusMap, + asyncResp, addReportReq)); } } |