mirror of https://github.com/Icinga/icinga2.git
Call ExecuteCommandProcessFinishedHandler for notification and event commands
This commit is contained in:
parent
300bc89cb6
commit
27f8bc5920
|
@ -36,9 +36,14 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
||||||
|
|
||||||
int timeout = commandObj->GetTimeout();
|
int timeout = commandObj->GetTimeout();
|
||||||
|
|
||||||
|
std::function<void(const Value& commandLine, const ProcessResult&)> callback;
|
||||||
|
if (Checkable::ExecuteCommandProcessFinishedHandler) {
|
||||||
|
callback = Checkable::ExecuteCommandProcessFinishedHandler;
|
||||||
|
} else {
|
||||||
|
callback = std::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2);
|
||||||
|
}
|
||||||
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
|
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
|
||||||
resolvers, resolvedMacros, useResolvedMacros, timeout,
|
resolvers, resolvedMacros, useResolvedMacros, timeout, callback);
|
||||||
std::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginEventTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr)
|
void PluginEventTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr)
|
||||||
|
|
|
@ -53,9 +53,14 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
||||||
|
|
||||||
int timeout = commandObj->GetTimeout();
|
int timeout = commandObj->GetTimeout();
|
||||||
|
|
||||||
|
std::function<void(const Value& commandLine, const ProcessResult&)> callback;
|
||||||
|
if (Checkable::ExecuteCommandProcessFinishedHandler) {
|
||||||
|
callback = Checkable::ExecuteCommandProcessFinishedHandler;
|
||||||
|
} else {
|
||||||
|
callback = std::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2);
|
||||||
|
}
|
||||||
PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers,
|
PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers,
|
||||||
resolvedMacros, useResolvedMacros, timeout,
|
resolvedMacros, useResolvedMacros, timeout, callback);
|
||||||
std::bind(&PluginNotificationTask::ProcessFinishedHandler, checkable, _1, _2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr)
|
void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& commandLine, const ProcessResult& pr)
|
||||||
|
|
Loading…
Reference in New Issue