diff --git a/lib/config/activationcontext.hpp b/lib/config/activationcontext.hpp index e22f6b290..a2f9f9e1c 100644 --- a/lib/config/activationcontext.hpp +++ b/lib/config/activationcontext.hpp @@ -19,6 +19,12 @@ public: static ActivationContext::Ptr GetCurrentContext(); + static inline + void AssertOnContext() + { + GetCurrentContext(); + } + private: static void PushContext(const ActivationContext::Ptr& context); static void PopContext(); diff --git a/lib/config/applyrule.cpp b/lib/config/applyrule.cpp index fec461845..9df377d32 100644 --- a/lib/config/applyrule.cpp +++ b/lib/config/applyrule.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2012 Icinga GmbH // SPDX-License-Identifier: GPL-2.0-or-later +#include "config/activationcontext.hpp" #include "config/applyrule.hpp" #include "base/logger.hpp" #include @@ -62,6 +63,8 @@ void ApplyRule::AddRule(const String& sourceType, const String& targetType, cons const Expression::Ptr& expression, const Expression::Ptr& filter, const String& package, const String& fkvar, const String& fvvar, const Expression::Ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope) { + ActivationContext::AssertOnContext(); + auto actualTargetType (&targetType); if (*actualTargetType == "") {