From 8c1c38cf3e24154a592a557b2cb0505edbce3e99 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 2 Apr 2025 13:20:39 +0200 Subject: [PATCH] IfwApiCheckTask::ScriptFunc(): take CheckResultProducer::Ptr --- lib/methods/ifwapichecktask.cpp | 8 ++++---- lib/methods/ifwapichecktask.hpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/methods/ifwapichecktask.cpp b/lib/methods/ifwapichecktask.cpp index ce48deefc..b45159061 100644 --- a/lib/methods/ifwapichecktask.cpp +++ b/lib/methods/ifwapichecktask.cpp @@ -31,7 +31,7 @@ using namespace icinga; -REGISTER_FUNCTION_NONCONST(Internal, IfwApiCheck, &IfwApiCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION_NONCONST(Internal, IfwApiCheck, &IfwApiCheckTask::ScriptFunc, "checkable:cr:producer:resolvedMacros:useResolvedMacros"); static const char* GetUnderstandableError(const std::exception& ex) { @@ -194,7 +194,7 @@ static void DoIfwNetIo( } void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, - const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) + const CheckResultProducer::Ptr& producer, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) { namespace asio = boost::asio; namespace http = boost::beast::http; @@ -213,7 +213,7 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes if (!(commandEndpoint->GetCapabilities() & (uint_fast64_t)ApiCapabilities::IfwApiCheckCommand)) { // Assume "ifw-api-check-command" has been imported into a check command which can also work // based on "plugin-check-command", delegate respectively and hope for the best - PluginCheckTask::ScriptFunc(checkable, cr, resolvedMacros, useResolvedMacros); + PluginCheckTask::ScriptFunc(checkable, cr, producer, resolvedMacros, useResolvedMacros); return; } } @@ -275,7 +275,7 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes callback(cr->GetCommand(), pr); }; } else { - reportResult = [checkable, cr]() { checkable->ProcessCheckResult(cr); }; + reportResult = [checkable, cr, producer] { checkable->ProcessCheckResult(cr, producer); }; } // Set the default check result state and exit code to unknown for the moment! diff --git a/lib/methods/ifwapichecktask.hpp b/lib/methods/ifwapichecktask.hpp index 39327336b..5eb440849 100644 --- a/lib/methods/ifwapichecktask.hpp +++ b/lib/methods/ifwapichecktask.hpp @@ -18,7 +18,7 @@ class IfwApiCheckTask { public: static void ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, - const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros); + const CheckResultProducer::Ptr& producer, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros); private: IfwApiCheckTask();