mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-22 17:28:02 +02:00
Prevent apply rule creation outside of an activation context
just like object creation.
This commit is contained in:
parent
924068ceb8
commit
1c49db3783
@ -18,6 +18,12 @@ public:
|
|||||||
|
|
||||||
static ActivationContext::Ptr GetCurrentContext();
|
static ActivationContext::Ptr GetCurrentContext();
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void AssertOnContext()
|
||||||
|
{
|
||||||
|
GetCurrentContext();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void PushContext(const ActivationContext::Ptr& context);
|
static void PushContext(const ActivationContext::Ptr& context);
|
||||||
static void PopContext();
|
static void PopContext();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
||||||
|
|
||||||
|
#include "config/activationcontext.hpp"
|
||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -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 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)
|
const String& fvvar, const Expression::Ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope)
|
||||||
{
|
{
|
||||||
|
ActivationContext::AssertOnContext();
|
||||||
|
|
||||||
auto actualTargetType (&targetType);
|
auto actualTargetType (&targetType);
|
||||||
|
|
||||||
if (*actualTargetType == "") {
|
if (*actualTargetType == "") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user