mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7077 from Icinga/bugfix/no-api
Always update object authority & don't skip notifications in non-API setups
This commit is contained in:
commit
7242301fdb
|
@ -64,13 +64,17 @@ void NotificationComponent::NotificationTimerHandler()
|
||||||
{
|
{
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
||||||
|
/* Function already checks whether 'api' feature is enabled. */
|
||||||
|
Endpoint::Ptr myEndpoint = Endpoint::GetLocalEndpoint();
|
||||||
|
|
||||||
for (const Notification::Ptr& notification : ConfigType::GetObjectsByType<Notification>()) {
|
for (const Notification::Ptr& notification : ConfigType::GetObjectsByType<Notification>()) {
|
||||||
if (!notification->IsActive())
|
if (!notification->IsActive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String notificationName = notification->GetName();
|
String notificationName = notification->GetName();
|
||||||
|
|
||||||
if (notification->IsPaused() && GetEnableHA()) {
|
/* Skip notification if paused, in a cluster setup & HA feature is enabled. */
|
||||||
|
if (notification->IsPaused() && myEndpoint && GetEnableHA()) {
|
||||||
Log(LogNotice, "NotificationComponent")
|
Log(LogNotice, "NotificationComponent")
|
||||||
<< "Reminder notification '" << notificationName << "': HA cluster active, this endpoint does not have the authority (paused=true). Skipping.";
|
<< "Reminder notification '" << notificationName << "': HA cluster active, this endpoint does not have the authority (paused=true). Skipping.";
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -10,13 +10,14 @@ using namespace icinga;
|
||||||
|
|
||||||
void ApiListener::UpdateObjectAuthority()
|
void ApiListener::UpdateObjectAuthority()
|
||||||
{
|
{
|
||||||
ApiListener::Ptr instance = ApiListener::GetInstance();
|
/* Always run this, even if there is no 'api' feature enabled. */
|
||||||
|
if (auto listener = ApiListener::GetInstance()) {
|
||||||
if (!instance)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Log(LogNotice, "ApiListener")
|
Log(LogNotice, "ApiListener")
|
||||||
<< "Updating object authority for objects at endpoint '" << instance->GetIdentity() << "'.";
|
<< "Updating object authority for objects at endpoint '" << listener->GetIdentity() << "'.";
|
||||||
|
} else {
|
||||||
|
Log(LogNotice, "ApiListener")
|
||||||
|
<< "Updating object authority for local objects.";
|
||||||
|
}
|
||||||
|
|
||||||
Zone::Ptr my_zone = Zone::GetLocalZone();
|
Zone::Ptr my_zone = Zone::GetLocalZone();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue