[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaHostGroup(Legacy): Render assigned groups to all zones

git at icinga.org git at icinga.org
Wed Nov 30 08:14:47 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: c2734fd4d44e8cee10f48e79a93afc28a1c1dfd6
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=c2734fd4d44e8cee10f48e79a93afc28a1c1dfd6

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Tue Nov 15 14:39:41 2016 +0100

IcingaHostGroup(Legacy): Render assigned groups to all zones

So we still can support hosts with direct groups.

refs #13049

---

 library/Director/Objects/IcingaHostGroup.php |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/library/Director/Objects/IcingaHostGroup.php b/library/Director/Objects/IcingaHostGroup.php
index 6eb7a3a..be5f855 100644
--- a/library/Director/Objects/IcingaHostGroup.php
+++ b/library/Director/Objects/IcingaHostGroup.php
@@ -59,6 +59,15 @@ class IcingaHostGroup extends IcingaObjectGroup
         } else {
             $allMembers = array();
 
+            // make sure we write to all zones
+            // so host -> group relations are still possible
+            foreach (IcingaZone::loadAll($conn) as $zone) {
+                $zoneId = $zone->getAutoincId();
+                if (! array_key_exists($zoneId, $zoneMap)) {
+                    $zoneMap[$zoneId] = array();
+                }
+            }
+
             foreach ($zoneMap as $zoneId => $members) {
                 $file = $this->legacyZoneHostgroupFile($config, $zoneId);
                 $this->properties['members'] = $members;



More information about the icinga-checkins mailing list