mirror of https://github.com/Icinga/icinga2.git
Use ternary operator to get ExecuteOverride or checkable command
This commit is contained in:
parent
9c4a3aed1b
commit
c2f8d6df44
|
@ -28,11 +28,7 @@ void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRe
|
|||
if (resolvedMacros && !useResolvedMacros)
|
||||
return;
|
||||
|
||||
CheckCommand::Ptr command;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
command = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
command = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
String commandName = command->GetName();
|
||||
|
||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||
|
|
|
@ -21,11 +21,7 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
|||
REQUIRE_NOT_NULL(cr);
|
||||
|
||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||
CheckCommand::Ptr command;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
command = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
command = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
String commandName = command->GetName();
|
||||
|
||||
if (!listener) {
|
||||
|
|
|
@ -22,11 +22,7 @@ void DummyCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResu
|
|||
REQUIRE_NOT_NULL(checkable);
|
||||
REQUIRE_NOT_NULL(cr);
|
||||
|
||||
CheckCommand::Ptr command;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
command = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
command = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
|
|
@ -26,11 +26,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
REQUIRE_NOT_NULL(checkable);
|
||||
REQUIRE_NOT_NULL(cr);
|
||||
|
||||
CheckCommand::Ptr command;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
command = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
command = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
|
|
@ -22,11 +22,7 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
REQUIRE_NOT_NULL(checkable);
|
||||
REQUIRE_NOT_NULL(cr);
|
||||
|
||||
CheckCommand::Ptr commandObj;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
commandObj = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
commandObj = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr commandObj = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
|
|
@ -21,11 +21,7 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
|||
{
|
||||
REQUIRE_NOT_NULL(checkable);
|
||||
|
||||
EventCommand::Ptr commandObj;
|
||||
if (EventCommand::ExecuteOverride)
|
||||
commandObj = EventCommand::ExecuteOverride;
|
||||
else
|
||||
commandObj = checkable->GetEventCommand();
|
||||
EventCommand::Ptr commandObj = EventCommand::ExecuteOverride ? EventCommand::ExecuteOverride : checkable->GetEventCommand();
|
||||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
|
|
@ -25,11 +25,7 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
|||
REQUIRE_NOT_NULL(notification);
|
||||
REQUIRE_NOT_NULL(user);
|
||||
|
||||
NotificationCommand::Ptr commandObj;
|
||||
if (NotificationCommand::ExecuteOverride)
|
||||
commandObj = NotificationCommand::ExecuteOverride;
|
||||
else
|
||||
commandObj = notification->GetCommand();
|
||||
NotificationCommand::Ptr commandObj = NotificationCommand::ExecuteOverride ? NotificationCommand::ExecuteOverride : notification->GetCommand();
|
||||
|
||||
auto type = static_cast<NotificationType>(itype);
|
||||
|
||||
|
|
|
@ -31,11 +31,7 @@ void RandomCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
+ ". Icinga 2 has been running for " + Utility::FormatDuration(uptime)
|
||||
+ ". Version: " + Application::GetAppVersion();
|
||||
|
||||
CheckCommand::Ptr command;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
command = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
command = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
String commandName = command->GetName();
|
||||
ServiceState state = static_cast<ServiceState>(Utility::Random() % 4);
|
||||
|
||||
|
|
|
@ -18,11 +18,7 @@ void SleepCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResu
|
|||
REQUIRE_NOT_NULL(checkable);
|
||||
REQUIRE_NOT_NULL(cr);
|
||||
|
||||
CheckCommand::Ptr commandObj;
|
||||
if (CheckCommand::ExecuteOverride)
|
||||
commandObj = CheckCommand::ExecuteOverride;
|
||||
else
|
||||
commandObj = checkable->GetCheckCommand();
|
||||
CheckCommand::Ptr commandObj = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
|
|
Loading…
Reference in New Issue