mirror of https://github.com/Icinga/icinga2.git
parent
42818ab758
commit
e09fb88cae
|
@ -76,6 +76,17 @@ private:
|
|||
} } }
|
||||
|
||||
#define REGISTER_SCRIPTFUNCTION_NS(ns, name, callback) \
|
||||
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
|
||||
void RegisterFunction(void) { \
|
||||
Function::Ptr sf = new icinga::Function(#ns "#" #name, WrapFunction(callback), false); \
|
||||
ScriptGlobal::Set(#ns "." #name, sf); \
|
||||
Function::Ptr dsf = new icinga::Function("__" #name " (deprecated)", WrapFunction(callback), false, true); \
|
||||
ScriptGlobal::Set("__" #name, dsf); \
|
||||
} \
|
||||
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||
} } }
|
||||
|
||||
#define REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(ns, name, callback) \
|
||||
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
|
||||
void RegisterFunction(void) { \
|
||||
Function::Ptr sf = new icinga::Function(#ns "#" #name, WrapFunction(callback), false); \
|
||||
|
@ -96,6 +107,17 @@ private:
|
|||
} } }
|
||||
|
||||
#define REGISTER_SAFE_SCRIPTFUNCTION_NS(ns, name, callback) \
|
||||
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
|
||||
void RegisterFunction(void) { \
|
||||
Function::Ptr sf = new icinga::Function(#ns "#" #name, WrapFunction(callback), true); \
|
||||
ScriptGlobal::Set(#ns "." #name, sf); \
|
||||
Function::Ptr dsf = new icinga::Function("__" #name " (deprecated)", WrapFunction(callback), true, true); \
|
||||
ScriptGlobal::Set("__" #name, dsf); \
|
||||
} \
|
||||
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||
} } }
|
||||
|
||||
#define REGISTER_SAFE_SCRIPTFUNCTION_NS_DEPRECATED(ns, name, callback) \
|
||||
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
|
||||
void RegisterFunction(void) { \
|
||||
Function::Ptr sf = new icinga::Function(#ns "#" #name, WrapFunction(callback), true); \
|
||||
|
@ -105,6 +127,7 @@ private:
|
|||
} \
|
||||
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||
} } }
|
||||
|
||||
}
|
||||
|
||||
#endif /* SCRIPTFUNCTION_H */
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, IdoCheck, &IdoCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, IdoCheck, &IdoCheckTask::ScriptFunc);
|
||||
|
||||
void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc);
|
||||
|
||||
bool LegacyTimePeriod::IsInTimeRange(tm *begin, tm *end, int stride, tm *reference)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, ClrCheck, &ClrCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, ClrCheck, &ClrCheckTask::ScriptFunc);
|
||||
|
||||
static boost::once_flag l_OnceFlag = BOOST_ONCE_INIT;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc);
|
||||
|
||||
void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc);
|
||||
|
||||
void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc);
|
||||
|
||||
void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc);
|
||||
|
||||
void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, NullCheck, &NullCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, NullCheck, &NullCheckTask::ScriptFunc);
|
||||
|
||||
void NullCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, NullEvent, &NullEventTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, NullEvent, &NullEventTask::ScriptFunc);
|
||||
|
||||
void NullEventTask::ScriptFunc(const Checkable::Ptr&, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
{ }
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, PluginCheck, &PluginCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, PluginCheck, &PluginCheckTask::ScriptFunc);
|
||||
|
||||
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, PluginEvent, &PluginEventTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, PluginEvent, &PluginEventTask::ScriptFunc);
|
||||
|
||||
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, PluginNotification, &PluginNotificationTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, PluginNotification, &PluginNotificationTask::ScriptFunc);
|
||||
|
||||
void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
||||
const User::Ptr& user, const CheckResult::Ptr& cr, int itype,
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, RandomCheck, &RandomCheckTask::ScriptFunc);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, RandomCheck, &RandomCheckTask::ScriptFunc);
|
||||
|
||||
void RandomCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate);
|
||||
REGISTER_SCRIPTFUNCTION_NS(Internal, EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate);
|
||||
REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(Internal, EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate);
|
||||
|
||||
Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr&, double, double)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue