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

git at icinga.org git at icinga.org
Tue Nov 15 15:09:15 CET 2016


Module: icingaweb2-module-director
Branch: feature/icinga-legacy-config-13049
Commit: f56ed7043ad54e26e1e6fe1360a9d662b3ad18a9
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=f56ed7043ad54e26e1e6fe1360a9d662b3ad18a9

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