From dc06209e4a1fde50386a4747fd25c8bd3da77b79 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 9 Aug 2016 10:40:29 +0200 Subject: [PATCH] Move internal script functions into the 'Internal' namespace fixes #12338 --- itl/CMakeLists.txt | 2 +- itl/itl | 1 - lib/base/configobject.cpp | 1 - lib/base/function.hpp | 21 ++++++- lib/base/loader.hpp | 1 - lib/base/scriptglobal.cpp | 29 +++++++++- lib/config/configitem.cpp | 47 ++++++++-------- lib/config/configitem.hpp | 6 +- lib/db_ido/db_ido-itl.conf | 14 +++-- lib/db_ido/idochecktask.cpp | 2 +- lib/icinga/CMakeLists.txt | 4 +- .../icinga/icinga-itl.conf | 8 ++- lib/icinga/legacytimeperiod.cpp | 2 +- lib/methods/clrchecktask.cpp | 2 +- lib/methods/clusterchecktask.cpp | 2 +- lib/methods/clusterzonechecktask.cpp | 2 +- lib/methods/exceptionchecktask.cpp | 2 +- lib/methods/icingachecktask.cpp | 2 +- lib/methods/methods-itl.conf | 56 ++++++++++--------- 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 +- 26 files changed, 134 insertions(+), 86 deletions(-) rename itl/timeperiod.conf => lib/icinga/icinga-itl.conf (90%) diff --git a/itl/CMakeLists.txt b/itl/CMakeLists.txt index 85ec7e0c9..7f12eb0d8 100644 --- a/itl/CMakeLists.txt +++ b/itl/CMakeLists.txt @@ -18,6 +18,6 @@ add_subdirectory(plugins-contrib.d) install( - FILES itl command.conf command-icinga.conf hangman timeperiod.conf plugins command-plugins.conf manubulon command-plugins-manubulon.conf windows-plugins command-plugins-windows.conf nscp command-nscp-local.conf plugins-contrib + FILES itl command.conf command-icinga.conf hangman plugins command-plugins.conf manubulon command-plugins-manubulon.conf windows-plugins command-plugins-windows.conf nscp command-nscp-local.conf plugins-contrib DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include ) diff --git a/itl/itl b/itl/itl index faa614644..dead0bb0a 100644 --- a/itl/itl +++ b/itl/itl @@ -24,4 +24,3 @@ include "command.conf" include "command-icinga.conf" -include "timeperiod.conf" diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 26cefeca1..520e4b231 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -548,7 +548,6 @@ void ConfigObject::RestoreObject(const String& message, int attributeTypes) if (!object) return; - ASSERT(!object->IsActive()); #ifdef I2_DEBUG Log(LogDebug, "ConfigObject") << "Restoring object '" << name << "' of type '" << type << "'."; diff --git a/lib/base/function.hpp b/lib/base/function.hpp index f08a6fdc7..6dba72582 100644 --- a/lib/base/function.hpp +++ b/lib/base/function.hpp @@ -63,7 +63,16 @@ private: Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \ ScriptGlobal::Set(#name, sf); \ } \ - INITIALIZE_ONCE(RegisterFunction); \ + INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \ + } } } + +#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(WrapFunction(callback)); \ + ScriptGlobal::Set(#ns "." #name, sf); \ + } \ + INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \ } } } #define REGISTER_SAFE_SCRIPTFUNCTION(name, callback) \ @@ -72,9 +81,17 @@ private: Function::Ptr sf = new icinga::Function(WrapFunction(callback), true); \ ScriptGlobal::Set(#name, sf); \ } \ - INITIALIZE_ONCE(RegisterFunction); \ + INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \ } } } +#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(WrapFunction(callback), true); \ + ScriptGlobal::Set(#ns "." #name, sf); \ + } \ + INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \ + } } } } #endif /* SCRIPTFUNCTION_H */ diff --git a/lib/base/loader.hpp b/lib/base/loader.hpp index bc1dddba9..12edc11c7 100644 --- a/lib/base/loader.hpp +++ b/lib/base/loader.hpp @@ -68,7 +68,6 @@ private: Loader(void); static boost::thread_specific_ptr >& GetDeferredInitializers(void); - }; } diff --git a/lib/base/scriptglobal.cpp b/lib/base/scriptglobal.cpp index b5b599000..d1dd26871 100644 --- a/lib/base/scriptglobal.cpp +++ b/lib/base/scriptglobal.cpp @@ -27,6 +27,7 @@ #include "base/objectlock.hpp" #include "base/exception.hpp" #include +#include #include using namespace icinga; @@ -47,7 +48,33 @@ Value ScriptGlobal::Get(const String& name, const Value *defaultValue) void ScriptGlobal::Set(const String& name, const Value& value) { - m_Globals->Set(name, value); + std::vector tokens; + boost::algorithm::split(tokens, name, boost::is_any_of(".")); + + if (tokens.empty()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Name must not be empty")); + + { + ObjectLock olock(m_Globals); + + Dictionary::Ptr parent = m_Globals; + + for (std::vector::size_type i = 0; i < tokens.size(); i++) { + const String& token = tokens[i]; + + if (i + 1 != tokens.size()) { + if (!parent->Contains(token)) { + Dictionary::Ptr dict = new Dictionary(); + parent->Set(token, dict); + parent = dict; + } else { + parent = parent->Get(token); + } + } + } + + parent->Set(tokens[tokens.size() - 1], value); + } } bool ScriptGlobal::Exists(const String& name) diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 5f95c210e..fa1b9714d 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -46,9 +46,7 @@ ConfigItem::TypeMap ConfigItem::m_Items; ConfigItem::ItemList ConfigItem::m_UnnamedItems; ConfigItem::IgnoredItemList ConfigItem::m_IgnoredItems; -#ifdef I2_DEBUG -REGISTER_SCRIPTFUNCTION(__run_with_activation_context, &ConfigItem::RunWithActivationContext); -#endif /* I2_DEBUG */ +REGISTER_SCRIPTFUNCTION_NS(Internal, run_with_activation_context, &ConfigItem::RunWithActivationContext); /** * Constructor for the ConfigItem class. @@ -534,9 +532,10 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue return true; } -bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector& newItems) +bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector& newItems, bool silent) { - Log(LogInformation, "ConfigItem", "Committing config item(s)."); + if (!silent) + Log(LogInformation, "ConfigItem", "Committing config item(s)."); if (!CommitNewItems(context, upq, newItems)) { upq.ReportExceptions("config"); @@ -550,30 +549,33 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u ApplyRule::CheckMatches(); - /* log stats for external parsers */ - typedef std::map ItemCountMap; - ItemCountMap itemCounts; - BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) { - if (!item->m_Object) - continue; + if (!silent) { + /* log stats for external parsers */ + typedef std::map ItemCountMap; + ItemCountMap itemCounts; + BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) { + if (!item->m_Object) + continue; - itemCounts[item->m_Object->GetReflectionType()]++; - } + itemCounts[item->m_Object->GetReflectionType()]++; + } - BOOST_FOREACH(const ItemCountMap::value_type& kv, itemCounts) { - Log(LogInformation, "ConfigItem") - << "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << "."; + BOOST_FOREACH(const ItemCountMap::value_type& kv, itemCounts) { + Log(LogInformation, "ConfigItem") + << "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << "."; + } } return true; } -bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector& newItems, bool runtimeCreated) +bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector& newItems, bool runtimeCreated, bool silent) { static boost::mutex mtx; boost::mutex::scoped_lock lock(mtx); - Log(LogInformation, "ConfigItem", "Triggering Start signal for config items"); + if (!silent) + Log(LogInformation, "ConfigItem", "Triggering Start signal for config items"); BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) { if (!item->m_Object) @@ -609,12 +611,12 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector newItems; - if (!CommitItems(scope.GetContext(), upq, newItems)) + if (!CommitItems(scope.GetContext(), upq, newItems, true)) return false; - if (!ActivateItems(upq, newItems)) + if (!ActivateItems(upq, newItems, false, true)) return false; return true; } -#endif /* I2_DEBUG */ std::vector ConfigItem::GetItems(const String& type) { diff --git a/lib/config/configitem.hpp b/lib/config/configitem.hpp index 19aff26a9..96e5e6ea4 100644 --- a/lib/config/configitem.hpp +++ b/lib/config/configitem.hpp @@ -68,12 +68,10 @@ public: static ConfigItem::Ptr GetByTypeAndName(const String& type, const String& name); - static bool CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector& newItems); - static bool ActivateItems(WorkQueue& upq, const std::vector& newItems, bool runtimeCreated = false); + static bool CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector& newItems, bool silent = false); + static bool ActivateItems(WorkQueue& upq, const std::vector& newItems, bool runtimeCreated = false, bool silent = false); -#ifdef I2_DEBUG static bool RunWithActivationContext(const Function::Ptr& function); -#endif /* I2_DEBUG */ static std::vector GetItems(const String& type); diff --git a/lib/db_ido/db_ido-itl.conf b/lib/db_ido/db_ido-itl.conf index c81fa668c..0ff414d24 100644 --- a/lib/db_ido/db_ido-itl.conf +++ b/lib/db_ido/db_ido-itl.conf @@ -17,10 +17,12 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -template CheckCommand "ido-check-command" { - execute = IdoCheck -} +assert(Internal.run_with_activation_context(function() { + template CheckCommand "ido-check-command" { + execute = Internal.IdoCheck + } -object CheckCommand "ido" { - import "ido-check-command" -} + object CheckCommand "ido" { + import "ido-check-command" + } +})) diff --git a/lib/db_ido/idochecktask.cpp b/lib/db_ido/idochecktask.cpp index 519262f49..4a63ba5b9 100644 --- a/lib/db_ido/idochecktask.cpp +++ b/lib/db_ido/idochecktask.cpp @@ -33,7 +33,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(IdoCheck, &IdoCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, IdoCheck, &IdoCheckTask::ScriptFunc); void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/icinga/CMakeLists.txt b/lib/icinga/CMakeLists.txt index 521da77b9..401792e0c 100644 --- a/lib/icinga/CMakeLists.txt +++ b/lib/icinga/CMakeLists.txt @@ -37,13 +37,15 @@ mkclass_target(timeperiod.ti timeperiod.tcpp timeperiod.thpp) mkclass_target(usergroup.ti usergroup.tcpp usergroup.thpp) mkclass_target(user.ti user.tcpp user.thpp) +mkembedconfig_target(icinga-itl.conf icinga-itl.cpp) + set(icinga_SOURCES apiactions.cpp apievents.cpp checkable.cpp checkable.thpp checkable-dependency.cpp checkable-downtime.cpp checkable-event.cpp checkable-flapping.cpp checkable-script.cpp checkcommand.cpp checkcommand.thpp checkresult.cpp checkresult.thpp cib.cpp clusterevents.cpp command.cpp command.thpp comment.cpp comment.thpp compatutility.cpp dependency.cpp dependency.thpp dependency-apply.cpp downtime.cpp downtime.thpp eventcommand.cpp eventcommand.thpp externalcommandprocessor.cpp host.cpp host.thpp hostgroup.cpp hostgroup.thpp icingaapplication.cpp icingaapplication.thpp - customvarobject.cpp customvarobject.thpp + icinga-itl.cpp customvarobject.cpp customvarobject.thpp legacytimeperiod.cpp macroprocessor.cpp notificationcommand.cpp notificationcommand.thpp notification.cpp notification.thpp notification-apply.cpp objectutils.cpp perfdatavalue.cpp perfdatavalue.thpp pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.thpp scheduleddowntime-apply.cpp service-apply.cpp checkable-check.cpp checkable-comment.cpp diff --git a/itl/timeperiod.conf b/lib/icinga/icinga-itl.conf similarity index 90% rename from itl/timeperiod.conf rename to lib/icinga/icinga-itl.conf index 7ed84100a..17b23dac3 100644 --- a/itl/timeperiod.conf +++ b/lib/icinga/icinga-itl.conf @@ -17,6 +17,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -template TimePeriod "legacy-timeperiod" { - update = LegacyTimePeriod -} +assert(Internal.run_with_activation_context(function() { + template TimePeriod "legacy-timeperiod" { + update = Internal.LegacyTimePeriod + } +})) diff --git a/lib/icinga/legacytimeperiod.cpp b/lib/icinga/legacytimeperiod.cpp index 2c08394e9..3ab43f0c6 100644 --- a/lib/icinga/legacytimeperiod.cpp +++ b/lib/icinga/legacytimeperiod.cpp @@ -31,7 +31,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc); bool LegacyTimePeriod::IsInTimeRange(tm *begin, tm *end, int stride, tm *reference) { diff --git a/lib/methods/clrchecktask.cpp b/lib/methods/clrchecktask.cpp index 39b24ab83..6e3580c82 100644 --- a/lib/methods/clrchecktask.cpp +++ b/lib/methods/clrchecktask.cpp @@ -39,7 +39,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(ClrCheck, &ClrCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, ClrCheck, &ClrCheckTask::ScriptFunc); static boost::once_flag l_OnceFlag = BOOST_ONCE_INIT; diff --git a/lib/methods/clusterchecktask.cpp b/lib/methods/clusterchecktask.cpp index 75e980654..99ebda29c 100644 --- a/lib/methods/clusterchecktask.cpp +++ b/lib/methods/clusterchecktask.cpp @@ -34,7 +34,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(ClusterCheck, &ClusterCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc); 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 03e332131..b31444547 100644 --- a/lib/methods/clusterzonechecktask.cpp +++ b/lib/methods/clusterzonechecktask.cpp @@ -30,7 +30,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc); void ClusterZoneCheckTask::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 f9a3516a9..6e2fa7ade 100644 --- a/lib/methods/exceptionchecktask.cpp +++ b/lib/methods/exceptionchecktask.cpp @@ -29,7 +29,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(ExceptionCheck, &ExceptionCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc); void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/icingachecktask.cpp b/lib/methods/icingachecktask.cpp index d39705d51..082881b1f 100644 --- a/lib/methods/icingachecktask.cpp +++ b/lib/methods/icingachecktask.cpp @@ -30,7 +30,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(IcingaCheck, &IcingaCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc); void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/methods-itl.conf b/lib/methods/methods-itl.conf index 3255be313..eed5dbbf6 100644 --- a/lib/methods/methods-itl.conf +++ b/lib/methods/methods-itl.conf @@ -17,38 +17,40 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -template CheckCommand "icinga-check-command" { - execute = IcingaCheck -} +assert(Internal.run_with_activation_context(function() { + template CheckCommand "icinga-check-command" { + execute = Internal.IcingaCheck + } -template CheckCommand "cluster-check-command" { - execute = ClusterCheck -} + template CheckCommand "cluster-check-command" { + execute = Internal.ClusterCheck + } -template CheckCommand "cluster-zone-check-command" { - execute = ClusterZoneCheck -} + template CheckCommand "cluster-zone-check-command" { + execute = Internal.ClusterZoneCheck + } -template CheckCommand "plugin-check-command" { - execute = PluginCheck -} + template CheckCommand "plugin-check-command" { + execute = Internal.PluginCheck + } -template CheckCommand "clr-check-command" { - execute = ClrCheck -} + template CheckCommand "clr-check-command" { + execute = Internal.ClrCheck + } -template NotificationCommand "plugin-notification-command" { - execute = PluginNotification -} + template NotificationCommand "plugin-notification-command" { + execute = Internal.PluginNotification + } -template EventCommand "plugin-event-command" { - execute = PluginEvent -} + template EventCommand "plugin-event-command" { + execute = Internal.PluginEvent + } -template CheckCommand "random-check-command" { - execute = RandomCheck -} + template CheckCommand "random-check-command" { + execute = Internal.RandomCheck + } -template CheckCommand "exception-check-command" { - execute = ExceptionCheck -} + template CheckCommand "exception-check-command" { + execute = Internal.ExceptionCheck + } +})) diff --git a/lib/methods/nullchecktask.cpp b/lib/methods/nullchecktask.cpp index 2df58e994..9f7a85d60 100644 --- a/lib/methods/nullchecktask.cpp +++ b/lib/methods/nullchecktask.cpp @@ -30,7 +30,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(NullCheck, &NullCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, NullCheck, &NullCheckTask::ScriptFunc); void NullCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/nulleventtask.cpp b/lib/methods/nulleventtask.cpp index 14b2b1234..e2bbff52b 100644 --- a/lib/methods/nulleventtask.cpp +++ b/lib/methods/nulleventtask.cpp @@ -23,7 +23,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(NullEvent, &NullEventTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, NullEvent, &NullEventTask::ScriptFunc); void NullEventTask::ScriptFunc(const Checkable::Ptr&, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) { } diff --git a/lib/methods/pluginchecktask.cpp b/lib/methods/pluginchecktask.cpp index d53e287f8..83ad4610a 100644 --- a/lib/methods/pluginchecktask.cpp +++ b/lib/methods/pluginchecktask.cpp @@ -34,7 +34,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(PluginCheck, &PluginCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, PluginCheck, &PluginCheckTask::ScriptFunc); 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 328a349e9..3e6f72f4f 100644 --- a/lib/methods/plugineventtask.cpp +++ b/lib/methods/plugineventtask.cpp @@ -32,7 +32,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(PluginEvent, &PluginEventTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, PluginEvent, &PluginEventTask::ScriptFunc); 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 e228eae32..28708684b 100644 --- a/lib/methods/pluginnotificationtask.cpp +++ b/lib/methods/pluginnotificationtask.cpp @@ -33,7 +33,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(PluginNotification, &PluginNotificationTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, PluginNotification, &PluginNotificationTask::ScriptFunc); 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 8a0cc2d29..3ace01ff8 100644 --- a/lib/methods/randomchecktask.cpp +++ b/lib/methods/randomchecktask.cpp @@ -30,7 +30,7 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(RandomCheck, &RandomCheckTask::ScriptFunc); +REGISTER_SCRIPTFUNCTION_NS(Internal, RandomCheck, &RandomCheckTask::ScriptFunc); void RandomCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros) diff --git a/lib/methods/timeperiodtask.cpp b/lib/methods/timeperiodtask.cpp index 90a58f4db..059877950 100644 --- a/lib/methods/timeperiodtask.cpp +++ b/lib/methods/timeperiodtask.cpp @@ -22,8 +22,8 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION(EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate); -REGISTER_SCRIPTFUNCTION(EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate); +REGISTER_SCRIPTFUNCTION_NS(Internal, EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate); +REGISTER_SCRIPTFUNCTION_NS(Internal, EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate); Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr&, double, double) {