mirror of
https://github.com/Icinga/icinga2.git
synced 2026-05-28 04:12:13 -04:00
Prevent apply rule creation outside of an activation context
just like object creation.
This commit is contained in:
parent
080640122a
commit
81d20dc35a
2 changed files with 9 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2012 Icinga GmbH <https://icinga.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "config/activationcontext.hpp"
|
||||
#include "config/applyrule.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include <set>
|
||||
|
|
@ -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 == "") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue