[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaHostForm: allow access to Zone and Agent...

git at icinga.org git at icinga.org
Thu Jan 12 13:45:16 CET 2017


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Jan 12 13:44:43 2017 +0100

IcingaHostForm: allow access to Zone and Agent...

...properties on every host

fixes #13965

---

 application/forms/IcingaHostForm.php |   35 ++++++++++++----------------------
 doc/10-How-it-works.md               |    4 +---
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/application/forms/IcingaHostForm.php b/application/forms/IcingaHostForm.php
index 910bd34..8ea2313 100644
--- a/application/forms/IcingaHostForm.php
+++ b/application/forms/IcingaHostForm.php
@@ -50,10 +50,6 @@ class IcingaHostForm extends DirectorObjectForm
      */
     protected function addClusteringElements()
     {
-        if (!$this->isTemplate() && !$this->hasClusterProperties()) {
-            return $this;
-        }
-
         $this->addZoneElement();
 
         $this->addBoolean('has_agent', array(
@@ -81,16 +77,18 @@ class IcingaHostForm extends DirectorObjectForm
             $this->addHidden('command_endpoint_id', null);
             $this->setSentValue('command_endpoint_id', null);
         } else {
-            $this->addElement('select', 'command_endpoint_id', array(
-                'label' => $this->translate('Command endpoint'),
-                'description' => $this->translate(
-                    'Setting a command endpoint allows you to force host checks'
-                    . ' to be executed by a specific endpoint. Please carefully'
-                    . ' study the related Icinga documentation before using this'
-                    . ' feature'
-                ),
-                'multiOptions' => $this->optionalEnum($this->enumEndpoints())
-            ));
+            if ($this->isTemplate()) {
+                $this->addElement('select', 'command_endpoint_id', array(
+                    'label' => $this->translate('Command endpoint'),
+                    'description' => $this->translate(
+                        'Setting a command endpoint allows you to force host checks'
+                        . ' to be executed by a specific endpoint. Please carefully'
+                        . ' study the related Icinga documentation before using this'
+                        . ' feature'
+                    ),
+                    'multiOptions' => $this->optionalEnum($this->enumEndpoints())
+                ));
+            }
 
             foreach (array('master_should_connect', 'accept_config') as $key) {
                 $this->addHidden($key, null);
@@ -118,15 +116,6 @@ class IcingaHostForm extends DirectorObjectForm
         return $this;
     }
 
-    protected function hasClusterProperties()
-    {
-        if (!$object = $this->object) {
-            return false;
-        }
-
-        return $object->get('zone_id') || $object->get('has_agent') === 'y';
-    }
-
     protected function beforeSuccessfulRedirect()
     {
         if ($this->allowsExperimental() && $this->getSentValue('create_live') === 'y') {
diff --git a/doc/10-How-it-works.md b/doc/10-How-it-works.md
index 32487ab..2503475 100644
--- a/doc/10-How-it-works.md
+++ b/doc/10-How-it-works.md
@@ -72,9 +72,7 @@ Zone membership handling
 
 Mostly you do not need to care much about Zones when working with the
 Director. In case you have no Satellite node, you wouldn't even notice
-their existence. When running Satellites, the way to go is to create
-dedicated templates for your zones. Usually this requires one template
-per Satellite zone.
+their existence.
 
 You are not required to deal with Agent Zones, as the Director does
 this for you. Please refer to [Working with agents](24-Working-with-agents.md)



More information about the icinga-checkins mailing list