[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObject: improve type detection

git at icinga.org git at icinga.org
Tue Aug 9 16:18:58 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Aug  9 14:17:57 2016 +0000

IcingaObject: improve type detection

fixes #12319

---

 library/Director/Cli/ObjectCommand.php    |    2 +-
 library/Director/Objects/IcingaObject.php |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/library/Director/Cli/ObjectCommand.php b/library/Director/Cli/ObjectCommand.php
index c8c1ed9..1011d9e 100644
--- a/library/Director/Cli/ObjectCommand.php
+++ b/library/Director/Cli/ObjectCommand.php
@@ -322,7 +322,7 @@ class ObjectCommand extends Command
     protected function load($name)
     {
         return IcingaObject::loadByType(
-            lcfirst($this->getType()),
+            $this->getType(),
             $name,
             $this->db()
         );
diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index 6a04a1c..e92ef9e 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -1705,7 +1705,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
     protected static function classByType($type)
     {
         // allow for icinga_host and host
-        $type = preg_replace('/^icinga_/', '', $type);
+        $type = lcfirst(preg_replace('/^icinga_/', '', $type));
 
         if (strpos($type, 'data') === false) {
             $prefix = 'Icinga';



More information about the icinga-checkins mailing list