From 9577af8e6de1a40b580c058a6493683b3fa8bb4e Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Mon, 26 May 2025 13:57:09 +0200 Subject: [PATCH] Drop `Checkable#process_check_result()` DSL function Not sure why it's introduced in the first place, maybe for debugging purposes at the early stage of Icinga 2 dev but I failed to see an actual useful use case for it that's worth its maintenance burden. So, this commit dropped it entirely from the DSL language. --- lib/icinga/CMakeLists.txt | 2 +- lib/icinga/checkable-script.cpp | 33 --------------------------------- lib/icinga/checkable.cpp | 2 +- lib/icinga/checkable.hpp | 2 -- 4 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 lib/icinga/checkable-script.cpp diff --git a/lib/icinga/CMakeLists.txt b/lib/icinga/CMakeLists.txt index 8187d48e8..2286fec94 100644 --- a/lib/icinga/CMakeLists.txt +++ b/lib/icinga/CMakeLists.txt @@ -30,7 +30,7 @@ set(icinga_SOURCES checkable.cpp checkable.hpp checkable-ti.hpp checkable-check.cpp checkable-comment.cpp checkable-dependency.cpp checkable-downtime.cpp checkable-event.cpp checkable-flapping.cpp - checkable-notification.cpp checkable-script.cpp + checkable-notification.cpp checkcommand.cpp checkcommand.hpp checkcommand-ti.hpp checkresult.cpp checkresult.hpp checkresult-ti.hpp cib.cpp cib.hpp diff --git a/lib/icinga/checkable-script.cpp b/lib/icinga/checkable-script.cpp deleted file mode 100644 index a455440ca..000000000 --- a/lib/icinga/checkable-script.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ - -#include "icinga/checkable.hpp" -#include "base/configobject.hpp" -#include "base/dictionary.hpp" -#include "base/function.hpp" -#include "base/functionwrapper.hpp" -#include "base/scriptframe.hpp" -#include "remote/apilistener.hpp" - -using namespace icinga; - -static void CheckableProcessCheckResult(const CheckResult::Ptr& cr) -{ - ScriptFrame *vframe = ScriptFrame::GetCurrentFrame(); - Checkable::Ptr self = vframe->Self; - REQUIRE_NOT_NULL(self); - - if (cr) { - auto api (ApiListener::GetInstance()); - - self->ProcessCheckResult(cr, api ? api->GetWaitGroup() : new StoppableWaitGroup()); - } -} - -Object::Ptr Checkable::GetPrototype() -{ - static Dictionary::Ptr prototype = new Dictionary({ - { "process_check_result", new Function("Checkable#process_check_result", CheckableProcessCheckResult, { "cr" }, false) } - }); - - return prototype; -} diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index 13fd778a3..690630f31 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -12,7 +12,7 @@ using namespace icinga; -REGISTER_TYPE_WITH_PROTOTYPE(Checkable, Checkable::GetPrototype()); +REGISTER_TYPE(Checkable); INITIALIZE_ONCE(&Checkable::StaticInitialize); const std::map Checkable::m_FlappingStateFilterMap ({ diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 310923ec8..eacfdb626 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -214,8 +214,6 @@ public: static int GetPendingChecks(); static void AquirePendingCheckSlot(int maxPendingChecks); - static Object::Ptr GetPrototype(); - protected: void Start(bool runtimeCreated) override; void OnConfigLoaded() override;