diff --git a/lib/config/activationcontext.hpp b/lib/config/activationcontext.hpp index 3fe5d09ab..2273cfbbc 100644 --- a/lib/config/activationcontext.hpp +++ b/lib/config/activationcontext.hpp @@ -18,6 +18,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 87399711e..68b19679f 100644 --- a/lib/config/applyrule.cpp +++ b/lib/config/applyrule.cpp @@ -1,5 +1,6 @@ /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ +#include "config/activationcontext.hpp" #include "config/applyrule.hpp" #include "base/logger.hpp" #include @@ -61,6 +62,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 == "") {