mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Empty command string on CHANGE_{HOST,SERVICE}_EVENTHANDLER should disable event handlers.
Fixes #5670
This commit is contained in:
parent
1408c26e5c
commit
ac35eadc8d
@ -2123,6 +2123,10 @@ void ExternalCommandProcessor::ChangeHostEventHandler(double time, const std::ve
|
||||
if (!hc)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change event handler for host '" + arguments[0] + "' which has no check service."));
|
||||
|
||||
/* empty command string implicitely disables event handler */
|
||||
if (arguments[1].IsEmpty()) {
|
||||
hc->SetEnableEventHandler(false);
|
||||
} else {
|
||||
EventCommand::Ptr command = EventCommand::GetByName(arguments[1]);
|
||||
|
||||
if (!command)
|
||||
@ -2136,6 +2140,7 @@ void ExternalCommandProcessor::ChangeHostEventHandler(double time, const std::ve
|
||||
hc->SetEventCommand(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeSvcEventHandler(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
@ -2147,6 +2152,10 @@ void ExternalCommandProcessor::ChangeSvcEventHandler(double time, const std::vec
|
||||
if (!service)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change event handler for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
|
||||
|
||||
/* empty command string implicitely disables event handler */
|
||||
if (arguments[2].IsEmpty()) {
|
||||
service->SetEnableEventHandler(false);
|
||||
} else {
|
||||
EventCommand::Ptr command = EventCommand::GetByName(arguments[2]);
|
||||
|
||||
if (!command)
|
||||
@ -2160,6 +2169,7 @@ void ExternalCommandProcessor::ChangeSvcEventHandler(double time, const std::vec
|
||||
service->SetEventCommand(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeHostCheckCommand(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user