From d9c0b6f806ac2330b902d257509def4fa74f35de Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 7 Aug 2018 13:55:41 +0200 Subject: [PATCH] Refactor REGISTER_SCRIPTFUNCTION_* macros --- lib/base/function.hpp | 42 ++--------------- lib/base/perfdatavalue.cpp | 2 +- lib/base/scriptutils.cpp | 64 +++++++++++++------------- lib/base/statsfunction.hpp | 2 +- lib/config/configitem.cpp | 2 +- lib/db_ido/idochecktask.cpp | 2 +- lib/icinga/legacytimeperiod.cpp | 2 +- lib/icinga/objectutils.cpp | 22 ++++----- lib/methods/clusterchecktask.cpp | 2 +- lib/methods/clusterzonechecktask.cpp | 2 +- lib/methods/dummychecktask.cpp | 2 +- lib/methods/exceptionchecktask.cpp | 2 +- lib/methods/icingachecktask.cpp | 2 +- lib/methods/nullchecktask.cpp | 2 +- lib/methods/nulleventtask.cpp | 2 +- lib/methods/pluginchecktask.cpp | 2 +- lib/methods/plugineventtask.cpp | 2 +- lib/methods/pluginnotificationtask.cpp | 2 +- lib/methods/randomchecktask.cpp | 2 +- lib/methods/timeperiodtask.cpp | 4 +- 20 files changed, 66 insertions(+), 98 deletions(-) diff --git a/lib/base/function.hpp b/lib/base/function.hpp index dd08df6ff..eae0a0792 100644 --- a/lib/base/function.hpp +++ b/lib/base/function.hpp @@ -17,8 +17,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#ifndef SCRIPTFUNCTION_H -#define SCRIPTFUNCTION_H +#ifndef FUNCTION_H +#define FUNCTION_H #include "base/i2-base.hpp" #include "base/function-ti.hpp" @@ -72,50 +72,18 @@ private: bool side_effect_free, bool deprecated); }; -#define REGISTER_SCRIPTFUNCTION_NS(ns, name, callback, args) \ +#define REGISTER_FUNCTION(ns, name, callback, args) \ INITIALIZE_ONCE_WITH_PRIORITY([]() { \ Function::Ptr sf = new icinga::Function(#ns "#" #name, callback, String(args).Split(":"), false); \ ScriptGlobal::Set(#ns "." #name, sf); \ }, 10) -#define REGISTER_SCRIPTFUNCTION_NS_PREFIX(ns, name, callback, args) \ - INITIALIZE_ONCE_WITH_PRIORITY([]() { \ - Function::Ptr sf = new icinga::Function(#ns "#" #name, callback, String(args).Split(":"), false); \ - ScriptGlobal::Set(#ns "." #name, sf); \ - Function::Ptr dsf = new icinga::Function("Deprecated#__" #name " (deprecated)", WrapFunction(callback), String(args).Split(":"), false, true); \ - ScriptGlobal::Set("Deprecated.__" #name, dsf); \ - }, 10) - -#define REGISTER_SCRIPTFUNCTION_NS_DEPRECATED(ns, name, callback, args) \ - INITIALIZE_ONCE_WITH_PRIORITY([]() { \ - Function::Ptr sf = new icinga::Function(#ns "#" #name, callback, String(args).Split(":"), false); \ - ScriptGlobal::Set(#ns "." #name, sf); \ - Function::Ptr dsf = new icinga::Function("Deprecated#" #name " (deprecated)", WrapFunction(callback), String(args).Split(":"), false, true); \ - ScriptGlobal::Set("Deprecated." #name, dsf); \ - }, 10) - -#define REGISTER_SAFE_SCRIPTFUNCTION_NS(ns, name, callback, args) \ +#define REGISTER_SAFE_FUNCTION(ns, name, callback, args) \ INITIALIZE_ONCE_WITH_PRIORITY([]() { \ Function::Ptr sf = new icinga::Function(#ns "#" #name, callback, String(args).Split(":"), true); \ ScriptGlobal::Set(#ns "." #name, sf); \ }, 10) -#define REGISTER_SAFE_SCRIPTFUNCTION_NS_PREFIX(ns, name, callback, args) \ - INITIALIZE_ONCE_WITH_PRIORITY([]() { \ - Function::Ptr sf = new icinga::Function(#ns "#" #name, callback, String(args).Split(":"), true); \ - ScriptGlobal::Set(#ns "." #name, sf); \ - Function::Ptr dsf = new icinga::Function("Deprecated#__" #name " (deprecated)", WrapFunction(callback), String(args).Split(":"), true, true); \ - ScriptGlobal::Set("Deprecated.__" #name, dsf); \ - }, 10) - -#define REGISTER_SAFE_SCRIPTFUNCTION_NS_DEPRECATED(ns, name, callback, args) \ - INITIALIZE_ONCE_WITH_PRIORITY([]() { \ - Function::Ptr sf = new icinga::Function(#ns "#" #name, callback, String(args).Split(":"), true); \ - ScriptGlobal::Set(#ns "." #name, sf); \ - Function::Ptr dsf = new icinga::Function("Deprecated#" #name " (deprecated)", WrapFunction(callback), String(args).Split(":"), true, true); \ - ScriptGlobal::Set("Deprecated." #name, dsf); \ - }, 10) - } -#endif /* SCRIPTFUNCTION_H */ +#endif /* FUNCTION_H */ diff --git a/lib/base/perfdatavalue.cpp b/lib/base/perfdatavalue.cpp index f2a93e128..0795c7644 100644 --- a/lib/base/perfdatavalue.cpp +++ b/lib/base/perfdatavalue.cpp @@ -27,7 +27,7 @@ using namespace icinga; REGISTER_TYPE(PerfdataValue); -REGISTER_SCRIPTFUNCTION_NS(System, parse_performance_data, PerfdataValue::Parse, "perfdata"); +REGISTER_FUNCTION(System, parse_performance_data, PerfdataValue::Parse, "perfdata"); PerfdataValue::PerfdataValue(const String& label, double value, bool counter, const String& unit, const Value& warn, const Value& crit, const Value& min, diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index 3c1a4e5a5..d0c947e6e 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -39,39 +39,39 @@ using namespace icinga; -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, regex, &ScriptUtils::Regex, "pattern:text:mode"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, match, &ScriptUtils::Match, "pattern:text:mode"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, cidr_match, &ScriptUtils::CidrMatch, "pattern:ip:mode"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, len, &ScriptUtils::Len, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, union, &ScriptUtils::Union, ""); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, intersection, &ScriptUtils::Intersection, ""); -REGISTER_SCRIPTFUNCTION_NS(System, log, &ScriptUtils::Log, "severity:facility:value"); -REGISTER_SCRIPTFUNCTION_NS(System, range, &ScriptUtils::Range, "start:end:increment"); -REGISTER_SCRIPTFUNCTION_NS(System, exit, &Application::Exit, "status"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, typeof, &ScriptUtils::TypeOf, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, keys, &ScriptUtils::Keys, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, random, &Utility::Random, ""); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, get_object, &ScriptUtils::GetObject, "type:name"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, get_objects, &ScriptUtils::GetObjects, "type"); -REGISTER_SCRIPTFUNCTION_NS(System, assert, &ScriptUtils::Assert, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, string, &ScriptUtils::CastString, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, number, &ScriptUtils::CastNumber, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, bool, &ScriptUtils::CastBool, "value"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, get_time, &Utility::GetTime, ""); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, basename, &Utility::BaseName, "path"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, dirname, &Utility::DirName, "path"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim, "component"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, track_parents, &ScriptUtils::TrackParents, "child"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, escape_shell_cmd, &Utility::EscapeShellCmd, "cmd"); -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, escape_shell_arg, &Utility::EscapeShellArg, "arg"); +REGISTER_SAFE_FUNCTION(System, regex, &ScriptUtils::Regex, "pattern:text:mode"); +REGISTER_SAFE_FUNCTION(System, match, &ScriptUtils::Match, "pattern:text:mode"); +REGISTER_SAFE_FUNCTION(System, cidr_match, &ScriptUtils::CidrMatch, "pattern:ip:mode"); +REGISTER_SAFE_FUNCTION(System, len, &ScriptUtils::Len, "value"); +REGISTER_SAFE_FUNCTION(System, union, &ScriptUtils::Union, ""); +REGISTER_SAFE_FUNCTION(System, intersection, &ScriptUtils::Intersection, ""); +REGISTER_FUNCTION(System, log, &ScriptUtils::Log, "severity:facility:value"); +REGISTER_FUNCTION(System, range, &ScriptUtils::Range, "start:end:increment"); +REGISTER_FUNCTION(System, exit, &Application::Exit, "status"); +REGISTER_SAFE_FUNCTION(System, typeof, &ScriptUtils::TypeOf, "value"); +REGISTER_SAFE_FUNCTION(System, keys, &ScriptUtils::Keys, "value"); +REGISTER_SAFE_FUNCTION(System, random, &Utility::Random, ""); +REGISTER_SAFE_FUNCTION(System, get_object, &ScriptUtils::GetObject, "type:name"); +REGISTER_SAFE_FUNCTION(System, get_objects, &ScriptUtils::GetObjects, "type"); +REGISTER_FUNCTION(System, assert, &ScriptUtils::Assert, "value"); +REGISTER_SAFE_FUNCTION(System, string, &ScriptUtils::CastString, "value"); +REGISTER_SAFE_FUNCTION(System, number, &ScriptUtils::CastNumber, "value"); +REGISTER_SAFE_FUNCTION(System, bool, &ScriptUtils::CastBool, "value"); +REGISTER_SAFE_FUNCTION(System, get_time, &Utility::GetTime, ""); +REGISTER_SAFE_FUNCTION(System, basename, &Utility::BaseName, "path"); +REGISTER_SAFE_FUNCTION(System, dirname, &Utility::DirName, "path"); +REGISTER_SAFE_FUNCTION(System, msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim, "component"); +REGISTER_SAFE_FUNCTION(System, track_parents, &ScriptUtils::TrackParents, "child"); +REGISTER_SAFE_FUNCTION(System, escape_shell_cmd, &Utility::EscapeShellCmd, "cmd"); +REGISTER_SAFE_FUNCTION(System, escape_shell_arg, &Utility::EscapeShellArg, "arg"); #ifdef _WIN32 -REGISTER_SAFE_SCRIPTFUNCTION_NS(System, escape_create_process_arg, &Utility::EscapeCreateProcessArg, "arg"); +REGISTER_SAFE_FUNCTION(System, escape_create_process_arg, &Utility::EscapeCreateProcessArg, "arg"); #endif /* _WIN32 */ -REGISTER_SCRIPTFUNCTION_NS(System, ptr, &ScriptUtils::Ptr, "object"); -REGISTER_SCRIPTFUNCTION_NS(System, sleep, &Utility::Sleep, "interval"); -REGISTER_SCRIPTFUNCTION_NS(System, path_exists, &Utility::PathExists, "path"); -REGISTER_SCRIPTFUNCTION_NS(System, glob, &ScriptUtils::Glob, "pathspec:callback:type"); -REGISTER_SCRIPTFUNCTION_NS(System, glob_recursive, &ScriptUtils::GlobRecursive, "pathspec:callback:type"); +REGISTER_FUNCTION(System, ptr, &ScriptUtils::Ptr, "object"); +REGISTER_FUNCTION(System, sleep, &Utility::Sleep, "interval"); +REGISTER_FUNCTION(System, path_exists, &Utility::PathExists, "path"); +REGISTER_FUNCTION(System, glob, &ScriptUtils::Glob, "pathspec:callback:type"); +REGISTER_FUNCTION(System, glob_recursive, &ScriptUtils::GlobRecursive, "pathspec:callback:type"); INITIALIZE_ONCE(&ScriptUtils::StaticInitialize); @@ -397,7 +397,7 @@ Type::Ptr ScriptUtils::TypeOf(const Value& value) return value.GetReflectionType(); } -Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict) +Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& obj) { ArrayData result; diff --git a/lib/base/statsfunction.hpp b/lib/base/statsfunction.hpp index 8dc5af4d7..aba496e75 100644 --- a/lib/base/statsfunction.hpp +++ b/lib/base/statsfunction.hpp @@ -27,7 +27,7 @@ namespace icinga { #define REGISTER_STATSFUNCTION(name, callback) \ - REGISTER_SCRIPTFUNCTION_NS(StatsFunctions, name, callback, "status:perfdata") + REGISTER_FUNCTION(StatsFunctions, name, callback, "status:perfdata") } diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index af2afd017..53c889b4d 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -48,7 +48,7 @@ ConfigItem::TypeMap ConfigItem::m_DefaultTemplates; ConfigItem::ItemList ConfigItem::m_UnnamedItems; ConfigItem::IgnoredItemList ConfigItem::m_IgnoredItems; -REGISTER_SCRIPTFUNCTION_NS(Internal, run_with_activation_context, &ConfigItem::RunWithActivationContext, "func"); +REGISTER_FUNCTION(Internal, run_with_activation_context, &ConfigItem::RunWithActivationContext, "func"); /** * Constructor for the ConfigItem class. diff --git a/lib/db_ido/idochecktask.cpp b/lib/db_ido/idochecktask.cpp index 544c2cefb..20fc57d0b 100644 --- a/lib/db_ido/idochecktask.cpp +++ b/lib/db_ido/idochecktask.cpp @@ -32,7 +32,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, IdoCheck, &IdoCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, IdoCheck, &IdoCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/icinga/legacytimeperiod.cpp b/lib/icinga/legacytimeperiod.cpp index 5fe893035..8075d2810 100644 --- a/lib/icinga/legacytimeperiod.cpp +++ b/lib/icinga/legacytimeperiod.cpp @@ -28,7 +28,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc, "tp:begin:end"); +REGISTER_FUNCTION(Internal, LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc, "tp:begin:end"); bool LegacyTimePeriod::IsInTimeRange(tm *begin, tm *end, int stride, tm *reference) { diff --git a/lib/icinga/objectutils.cpp b/lib/icinga/objectutils.cpp index f41143037..b8057ef18 100644 --- a/lib/icinga/objectutils.cpp +++ b/lib/icinga/objectutils.cpp @@ -29,17 +29,17 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(System, get_host, &Host::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_service, &ObjectUtils::GetService, "host:name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_services, &ObjectUtils::GetServices, "host"); -REGISTER_SCRIPTFUNCTION_NS(System, get_user, &User::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_check_command, &CheckCommand::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_event_command, &EventCommand::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_notification_command, &NotificationCommand::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_host_group, &HostGroup::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_service_group, &ServiceGroup::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_user_group, &UserGroup::GetByName, "name"); -REGISTER_SCRIPTFUNCTION_NS(System, get_time_period, &TimePeriod::GetByName, "name"); +REGISTER_FUNCTION(System, get_host, &Host::GetByName, "name"); +REGISTER_FUNCTION(System, get_service, &ObjectUtils::GetService, "host:name"); +REGISTER_FUNCTION(System, get_services, &ObjectUtils::GetServices, "host"); +REGISTER_FUNCTION(System, get_user, &User::GetByName, "name"); +REGISTER_FUNCTION(System, get_check_command, &CheckCommand::GetByName, "name"); +REGISTER_FUNCTION(System, get_event_command, &EventCommand::GetByName, "name"); +REGISTER_FUNCTION(System, get_notification_command, &NotificationCommand::GetByName, "name"); +REGISTER_FUNCTION(System, get_host_group, &HostGroup::GetByName, "name"); +REGISTER_FUNCTION(System, get_service_group, &ServiceGroup::GetByName, "name"); +REGISTER_FUNCTION(System, get_user_group, &UserGroup::GetByName, "name"); +REGISTER_FUNCTION(System, get_time_period, &TimePeriod::GetByName, "name"); Service::Ptr ObjectUtils::GetService(const Value& host, const String& name) { diff --git a/lib/methods/clusterchecktask.cpp b/lib/methods/clusterchecktask.cpp index 7473eb1ad..3e9bdea21 100644 --- a/lib/methods/clusterchecktask.cpp +++ b/lib/methods/clusterchecktask.cpp @@ -33,7 +33,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/clusterzonechecktask.cpp b/lib/methods/clusterzonechecktask.cpp index 04056f7c3..2b1badf0c 100644 --- a/lib/methods/clusterzonechecktask.cpp +++ b/lib/methods/clusterzonechecktask.cpp @@ -29,7 +29,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/dummychecktask.cpp b/lib/methods/dummychecktask.cpp index 516cc23ea..51cc63480 100644 --- a/lib/methods/dummychecktask.cpp +++ b/lib/methods/dummychecktask.cpp @@ -31,7 +31,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, DummyCheck, &DummyCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, DummyCheck, &DummyCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void DummyCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/exceptionchecktask.cpp b/lib/methods/exceptionchecktask.cpp index cb5ce76df..3f07c396a 100644 --- a/lib/methods/exceptionchecktask.cpp +++ b/lib/methods/exceptionchecktask.cpp @@ -29,7 +29,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index 3f4d299da..ae263a4dc 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -34,7 +34,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/nullchecktask.cpp b/lib/methods/nullchecktask.cpp index df99c338e..85ee94444 100644 --- a/lib/methods/nullchecktask.cpp +++ b/lib/methods/nullchecktask.cpp @@ -30,7 +30,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, NullCheck, &NullCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, NullCheck, &NullCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void NullCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/nulleventtask.cpp b/lib/methods/nulleventtask.cpp index e515d31e8..1805e3e9f 100644 --- a/lib/methods/nulleventtask.cpp +++ b/lib/methods/nulleventtask.cpp @@ -23,7 +23,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, NullEvent, &NullEventTask::ScriptFunc, "checkable:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, NullEvent, &NullEventTask::ScriptFunc, "checkable:resolvedMacros:useResolvedMacros"); void NullEventTask::ScriptFunc(const Checkable::Ptr& checkable, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) { diff --git a/lib/methods/pluginchecktask.cpp b/lib/methods/pluginchecktask.cpp index b98eec4a7..402c36e0a 100644 --- a/lib/methods/pluginchecktask.cpp +++ b/lib/methods/pluginchecktask.cpp @@ -31,7 +31,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, PluginCheck, &PluginCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, PluginCheck, &PluginCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/plugineventtask.cpp b/lib/methods/plugineventtask.cpp index 11774c7e2..00b55fb8a 100644 --- a/lib/methods/plugineventtask.cpp +++ b/lib/methods/plugineventtask.cpp @@ -31,7 +31,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, PluginEvent, &PluginEventTask::ScriptFunc, "checkable:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, PluginEvent, &PluginEventTask::ScriptFunc, "checkable:resolvedMacros:useResolvedMacros"); void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/pluginnotificationtask.cpp b/lib/methods/pluginnotificationtask.cpp index c33d29e55..e345e2a01 100644 --- a/lib/methods/pluginnotificationtask.cpp +++ b/lib/methods/pluginnotificationtask.cpp @@ -32,7 +32,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, PluginNotification, &PluginNotificationTask::ScriptFunc, "notification:user:cr:itype:author:comment:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, PluginNotification, &PluginNotificationTask::ScriptFunc, "notification:user:cr:itype:author:comment:resolvedMacros:useResolvedMacros"); void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification, const User::Ptr& user, const CheckResult::Ptr& cr, int itype, diff --git a/lib/methods/randomchecktask.cpp b/lib/methods/randomchecktask.cpp index bdf2d54d4..c228057a5 100644 --- a/lib/methods/randomchecktask.cpp +++ b/lib/methods/randomchecktask.cpp @@ -29,7 +29,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, RandomCheck, &RandomCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); +REGISTER_FUNCTION(Internal, RandomCheck, &RandomCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros"); void RandomCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/timeperiodtask.cpp b/lib/methods/timeperiodtask.cpp index 152139e38..9cef126ed 100644 --- a/lib/methods/timeperiodtask.cpp +++ b/lib/methods/timeperiodtask.cpp @@ -22,8 +22,8 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION_NS(Internal, EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate, "tp:begin:end"); -REGISTER_SCRIPTFUNCTION_NS(Internal, EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate, "tp:begin:end"); +REGISTER_FUNCTION(Internal, EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate, "tp:begin:end"); +REGISTER_FUNCTION(Internal, EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate, "tp:begin:end"); Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr& tp, double, double) {