[icinga-checkins] icinga.org: icingaweb2-module-director/feature-ddo-playground: StateObject : add getUniqueName helper

git at icinga.org git at icinga.org
Tue Jul 19 10:31:52 CEST 2016


Module: icingaweb2-module-director
Branch: feature-ddo-playground
Commit: 9c831a2be675bf2cdd8d7098c67825841b62d1ef
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=9c831a2be675bf2cdd8d7098c67825841b62d1ef

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jun 21 13:50:03 2016 +0200

StateObject: add getUniqueName helper

---

 library/Director/Ddo/StateObject.php |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/library/Director/Ddo/StateObject.php b/library/Director/Ddo/StateObject.php
index 999d0a5..b19ae61 100644
--- a/library/Director/Ddo/StateObject.php
+++ b/library/Director/Ddo/StateObject.php
@@ -105,5 +105,15 @@ abstract class StateObject extends DdoObject
         return $this->get('acknowledged') === 'y';
     }
 
+    public function getUniqueName()
+    {
+        $key = $this->get('host');
+        if ($this->hasProperty('service')) {
+            $key .= '!' . $this->get('service');
+        }
+
+        return $key;
+    }
+
     abstract protected function getSortingState();
 }



More information about the icinga-checkins mailing list