[icinga-checkins] icinga.org: icinga2-migration/master: Properly index service templates

git at icinga.org git at icinga.org
Tue Jun 10 23:19:52 CEST 2014


Module: icinga2-migration
Branch: master
Commit: 8298db5871d2b1d2874339c4f51e5f9a4651e7f5
URL:    https://git.icinga.org/?p=icinga2-migration.git;a=commit;h=8298db5871d2b1d2874339c4f51e5f9a4651e7f5

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Tue Jun 10 23:17:25 2014 +0200

Properly index service templates

---

 modules/conftool/application/clicommands/MigrateCommand.php |    6 ------
 modules/conftool/library/Conftool/Icinga/IcingaConfig.php   |    5 +++--
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/modules/conftool/application/clicommands/MigrateCommand.php b/modules/conftool/application/clicommands/MigrateCommand.php
index 8211775..e453147 100644
--- a/modules/conftool/application/clicommands/MigrateCommand.php
+++ b/modules/conftool/application/clicommands/MigrateCommand.php
@@ -49,11 +49,5 @@ class MigrateCommand extends Command
         foreach ($config->getDefinitions('timeperiod') as $object) {
             Icinga2ObjectDefinition::fromIcingaObjectDefinition($object, $config)->dump();
         }
-        //templates
-/*
-         foreach($config->getTemplates() as $template) {
-            Icinga2ObjectDefinition::fromIcingaObjectDefinition($template, $config)->dump();
-        }
- */
     }
 }
diff --git a/modules/conftool/library/Conftool/Icinga/IcingaConfig.php b/modules/conftool/library/Conftool/Icinga/IcingaConfig.php
index 1faf5b2..2137485 100644
--- a/modules/conftool/library/Conftool/Icinga/IcingaConfig.php
+++ b/modules/conftool/library/Conftool/Icinga/IcingaConfig.php
@@ -322,8 +322,9 @@ class IcingaConfig
 
     protected function createDefinitionIndex($definition)
     {
-        /* services cannot be indexed as they are not unique */
-        if ($definition instanceof IcingaService) {
+	    /* service objects cannot be indexed as they are not unique
+	     * service templates must be, and can just be indexed */
+        if ($definition instanceof IcingaService && ! $definition->isTemplate()) {
             return;
         }
 



More information about the icinga-checkins mailing list