[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObjectMultiRelations( Legacy): add toLegacyConfigString

git at icinga.org git at icinga.org
Thu Nov 3 14:23:26 CET 2016


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

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Fri Oct 14 15:42:29 2016 +0200

IcingaObjectMultiRelations(Legacy): add toLegacyConfigString

refs #12919

---

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

diff --git a/library/Director/Objects/IcingaObjectMultiRelations.php b/library/Director/Objects/IcingaObjectMultiRelations.php
index 5413d75..0d0a1a5 100644
--- a/library/Director/Objects/IcingaObjectMultiRelations.php
+++ b/library/Director/Objects/IcingaObjectMultiRelations.php
@@ -8,6 +8,7 @@ use Iterator;
 use Countable;
 use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
 use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
+use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
 
 class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRenderer
 {
@@ -414,4 +415,15 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
             }
         }
     }
+
+    public function toLegacyConfigString()
+    {
+        $relations = array_keys($this->relations);
+
+        if (empty($relations)) {
+            return '';
+        }
+
+        return c1::renderKeyValue($this->propertyName, c1::renderArray($relations));
+    }
 }



More information about the icinga-checkins mailing list