mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 06:34:42 +02:00
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)
|
if (resolvedMacros && !useResolvedMacros)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CheckCommand::Ptr command;
|
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
command = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
command = checkable->GetCheckCommand();
|
|
||||||
String commandName = command->GetName();
|
String commandName = command->GetName();
|
||||||
|
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
|
@ -21,11 +21,7 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
|||||||
REQUIRE_NOT_NULL(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
CheckCommand::Ptr command;
|
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
command = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
command = checkable->GetCheckCommand();
|
|
||||||
String commandName = command->GetName();
|
String commandName = command->GetName();
|
||||||
|
|
||||||
if (!listener) {
|
if (!listener) {
|
||||||
|
@ -22,11 +22,7 @@ void DummyCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResu
|
|||||||
REQUIRE_NOT_NULL(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
REQUIRE_NOT_NULL(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
CheckCommand::Ptr command;
|
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
command = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
command = checkable->GetCheckCommand();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -26,11 +26,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||||||
REQUIRE_NOT_NULL(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
REQUIRE_NOT_NULL(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
CheckCommand::Ptr command;
|
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
command = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
command = checkable->GetCheckCommand();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -22,11 +22,7 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||||||
REQUIRE_NOT_NULL(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
REQUIRE_NOT_NULL(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
CheckCommand::Ptr commandObj;
|
CheckCommand::Ptr commandObj = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
commandObj = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
commandObj = checkable->GetCheckCommand();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -21,11 +21,7 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
|||||||
{
|
{
|
||||||
REQUIRE_NOT_NULL(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
|
|
||||||
EventCommand::Ptr commandObj;
|
EventCommand::Ptr commandObj = EventCommand::ExecuteOverride ? EventCommand::ExecuteOverride : checkable->GetEventCommand();
|
||||||
if (EventCommand::ExecuteOverride)
|
|
||||||
commandObj = EventCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
commandObj = checkable->GetEventCommand();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -25,11 +25,7 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
|||||||
REQUIRE_NOT_NULL(notification);
|
REQUIRE_NOT_NULL(notification);
|
||||||
REQUIRE_NOT_NULL(user);
|
REQUIRE_NOT_NULL(user);
|
||||||
|
|
||||||
NotificationCommand::Ptr commandObj;
|
NotificationCommand::Ptr commandObj = NotificationCommand::ExecuteOverride ? NotificationCommand::ExecuteOverride : notification->GetCommand();
|
||||||
if (NotificationCommand::ExecuteOverride)
|
|
||||||
commandObj = NotificationCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
commandObj = notification->GetCommand();
|
|
||||||
|
|
||||||
auto type = static_cast<NotificationType>(itype);
|
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)
|
+ ". Icinga 2 has been running for " + Utility::FormatDuration(uptime)
|
||||||
+ ". Version: " + Application::GetAppVersion();
|
+ ". Version: " + Application::GetAppVersion();
|
||||||
|
|
||||||
CheckCommand::Ptr command;
|
CheckCommand::Ptr command = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
command = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
command = checkable->GetCheckCommand();
|
|
||||||
String commandName = command->GetName();
|
String commandName = command->GetName();
|
||||||
ServiceState state = static_cast<ServiceState>(Utility::Random() % 4);
|
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(checkable);
|
||||||
REQUIRE_NOT_NULL(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
CheckCommand::Ptr commandObj;
|
CheckCommand::Ptr commandObj = CheckCommand::ExecuteOverride ? CheckCommand::ExecuteOverride : checkable->GetCheckCommand();
|
||||||
if (CheckCommand::ExecuteOverride)
|
|
||||||
commandObj = CheckCommand::ExecuteOverride;
|
|
||||||
else
|
|
||||||
commandObj = checkable->GetCheckCommand();
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user