[icinga-checkins] icinga.org: icinga2/feature/modified-attributes-4746: Implement override_enable_notifications.

git at icinga.org git at icinga.org
Tue Nov 26 11:18:35 CET 2013


Module: icinga2
Branch: feature/modified-attributes-4746
Commit: 3107e925f9390f88a065f85b85308bdd46f3c8f8
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=3107e925f9390f88a065f85b85308bdd46f3c8f8

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Nov 26 11:18:05 2013 +0100

Implement override_enable_notifications.

Refs #4746

---

 lib/icinga/service-notification.cpp |    7 +++++--
 lib/icinga/service.cpp              |    6 ++++++
 lib/icinga/service.ti               |    1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/icinga/service-notification.cpp b/lib/icinga/service-notification.cpp
index 0f32995..0d69ab7 100644
--- a/lib/icinga/service-notification.cpp
+++ b/lib/icinga/service-notification.cpp
@@ -163,12 +163,15 @@ void Service::UpdateSlaveNotifications(void)
 
 bool Service::GetEnableNotifications(void) const
 {
-	return GetEnableNotificationsRaw();
+	if (!GetOverrideEnableNotifications().IsEmpty())
+		return GetOverrideEnableNotifications();
+	else
+		return GetEnableNotifications();
 }
 
 void Service::SetEnableNotifications(bool enabled, const String& authority)
 {
-	SetEnableNotificationsRaw(enabled);
+	SetOverrideEnableActiveChecks(enabled);
 
 	OnEnableNotificationsChanged(GetSelf(), enabled, authority);
 }
diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp
index 3a45529..e985c2a 100644
--- a/lib/icinga/service.cpp
+++ b/lib/icinga/service.cpp
@@ -264,6 +264,9 @@ int Service::GetModifiedAttributes(void) const
 {
 	int attrs = 0;
 
+	if (!GetOverrideEnableNotifications().IsEmpty())
+		attrs |= ModAttrNotificationsEnabled;
+
 	if (!GetOverrideEnableActiveChecks().IsEmpty())
 		attrs |= ModAttrActiveChecksEnabled;
 
@@ -286,6 +289,9 @@ int Service::GetModifiedAttributes(void) const
 
 void Service::SetModifiedAttributes(int flags)
 {
+	if ((flags & ModAttrNotificationsEnabled) == 0)
+		SetOverrideEnableNotifications(Empty);
+
 	if ((flags & ModAttrActiveChecksEnabled) == 0)
 		SetOverrideEnableActiveChecks(Empty);
 
diff --git a/lib/icinga/service.ti b/lib/icinga/service.ti
index 134a41c..7704d08 100644
--- a/lib/icinga/service.ti
+++ b/lib/icinga/service.ti
@@ -128,6 +128,7 @@ class Service : DynamicObject
 	[state] bool enable_perfdata {
 		default {{{ return true; }}}
 	};
+	[state] Value override_enable_notifications;
 	[state] Value override_enable_active_checks;
 	[state] Value override_enable_passive_checks;
 	[state] Value override_check_interval;





More information about the icinga-checkins mailing list