[icinga-checkins] icinga.org: icinga2/master: Fix missing IDO updates for groups

git at icinga.org git at icinga.org
Wed Aug 24 11:51:25 CEST 2016


Module: icinga2
Branch: master
Commit: aa62a69694c8ddbed58b3464feae2a3c185429c7
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=aa62a69694c8ddbed58b3464feae2a3c185429c7

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Aug 24 11:35:12 2016 +0200

Fix missing IDO updates for groups

fixes #12527

---

 lib/db_ido/hostdbobject.cpp    |    5 +++++
 lib/db_ido/servicedbobject.cpp |    5 +++++
 lib/db_ido/userdbobject.cpp    |   14 ++++++++++++++
 lib/db_ido/userdbobject.hpp    |    2 ++
 4 files changed, 26 insertions(+)

diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp
index 7292338..30ef27a 100644
--- a/lib/db_ido/hostdbobject.cpp
+++ b/lib/db_ido/hostdbobject.cpp
@@ -397,6 +397,11 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
 
 	Host::Ptr host = static_pointer_cast<Host>(GetObject());
 
+	Array::Ptr groups = host->GetGroups();
+
+	if (groups)
+		hashData += DbObject::HashValue(groups);
+
 	Array::Ptr parents = new Array();
 
 	/* parents */
diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp
index 921e159..b900909 100644
--- a/lib/db_ido/servicedbobject.cpp
+++ b/lib/db_ido/servicedbobject.cpp
@@ -357,6 +357,11 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
 
 	Service::Ptr service = static_pointer_cast<Service>(GetObject());
 
+	Array::Ptr groups = service->GetGroups();
+
+	if (groups)
+		hashData += DbObject::HashValue(groups);
+
 	Array::Ptr dependencies = new Array();
 
 	/* dependencies */
diff --git a/lib/db_ido/userdbobject.cpp b/lib/db_ido/userdbobject.cpp
index 60fe460..c50a78e 100644
--- a/lib/db_ido/userdbobject.cpp
+++ b/lib/db_ido/userdbobject.cpp
@@ -163,3 +163,17 @@ void UserDbObject::OnConfigUpdateHeavy(void)
 
 	DbObject::OnMultipleQueries(queries);
 }
+
+String UserDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) const
+{
+	String hashData = DbObject::CalculateConfigHash(configFields);
+
+	User::Ptr user = static_pointer_cast<User>(GetObject());
+
+	Array::Ptr groups = user->GetGroups();
+
+	if (groups)
+		hashData += DbObject::HashValue(groups);
+
+	return hashData;
+}
diff --git a/lib/db_ido/userdbobject.hpp b/lib/db_ido/userdbobject.hpp
index 20f18fa..2aa90be 100644
--- a/lib/db_ido/userdbobject.hpp
+++ b/lib/db_ido/userdbobject.hpp
@@ -43,6 +43,8 @@ protected:
 	virtual Dictionary::Ptr GetStatusFields(void) const override;
 
 	virtual void OnConfigUpdateHeavy(void) override;
+
+	virtual String CalculateConfigHash(const Dictionary::Ptr& configFields) const;
 };
 
 }



More information about the icinga-checkins mailing list