[icinga-checkins] icinga.org: icingaweb2-module-director/fiddle/mfrosch: WIP: IcingaObjectGroup: Support group applies

git at icinga.org git at icinga.org
Wed Jun 8 16:48:21 CEST 2016


Module: icingaweb2-module-director
Branch: fiddle/mfrosch
Commit: 023933af177369d2bbf97ad026459a7a95620f64
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=023933af177369d2bbf97ad026459a7a95620f64

Author: Markus Frosch <lazyfrosch at icinga.org>
Date:   Wed Jun  8 16:43:32 2016 +0200

WIP: IcingaObjectGroup: Support group applies

---

 library/Director/Objects/IcingaObjectGroup.php |   41 ++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/library/Director/Objects/IcingaObjectGroup.php b/library/Director/Objects/IcingaObjectGroup.php
index ff84087..1fafe2d 100644
--- a/library/Director/Objects/IcingaObjectGroup.php
+++ b/library/Director/Objects/IcingaObjectGroup.php
@@ -16,8 +16,49 @@ abstract class IcingaObjectGroup extends IcingaObject
         'display_name'          => null,
     );
 
+    /**
+     * Render groups without extra object_types
+     *
+     * @param IcingaConfig $config
+     */
+    public function renderToConfig(IcingaConfig $config)
+    {
+        if ($this->isDisabled() || $this->isExternal()) {
+            return;
+        }
+
+        $type = $this->getShortTableName();
+
+        $filename = strtolower($type) . 's';
+
+        $config->configFile(
+            'zones.d/' . $this->getRenderingZone($config) . '/' . $filename
+        )->addObject($this);
+    }
+
     public function getRenderingZone(IcingaConfig $config = null)
     {
         return $this->connection->getDefaultGlobalZoneName();
     }
+
+    /**
+     * Will always be an apply, when it supports applies
+     *
+     * @return bool
+     */
+    public function isApplyRule()
+    {
+        return $this->supportsApplyRules();
+    }
+
+    /**
+     * No extra object types
+     * 
+     * @return string
+     */
+    protected function getObjectTypeName()
+    {
+        return 'object';
+    }
+
 }



More information about the icinga-checkins mailing list