[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaService: disable services belonging to a...

git at icinga.org git at icinga.org
Sun Oct 30 11:52:52 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Sat Oct 29 22:06:52 2016 +0000

IcingaService: disable services belonging to a...

...single disabled host

fixes #12049

---

 library/Director/Objects/IcingaService.php |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/library/Director/Objects/IcingaService.php b/library/Director/Objects/IcingaService.php
index 862fe1d..acc0333 100644
--- a/library/Director/Objects/IcingaService.php
+++ b/library/Director/Objects/IcingaService.php
@@ -170,6 +170,18 @@ class IcingaService extends IcingaObject
         return $this->renderRelationProperty('host', $this->host_id, 'host_name');
     }
 
+    public function toConfigString()
+    {
+        $str = parent::toConfigString();
+
+        if ($this->host_id && $this->getRelated('host')->isDisabled()) {
+            return "/* --- This services host has been disabled ---\n"
+                . $str . "*/\n";
+        } else {
+            return $str;
+        }
+    }
+
     protected function renderObjectHeader()
     {
         if ($this->isApplyRule()



More information about the icinga-checkins mailing list