[icinga-checkins] icinga.org: icingaweb2-module-director/master: ConfigJob: add configForLatestActivityExists()

git at icinga.org git at icinga.org
Thu Jun 16 16:13:49 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Jun 16 15:51:43 2016 +0200

ConfigJob: add configForLatestActivityExists()

---

 library/Director/Job/ConfigJob.php |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/library/Director/Job/ConfigJob.php b/library/Director/Job/ConfigJob.php
index 39b7095..1225f46 100644
--- a/library/Director/Job/ConfigJob.php
+++ b/library/Director/Job/ConfigJob.php
@@ -52,9 +52,18 @@ class ConfigJob extends JobHook
 
     protected function shouldGenerate()
     {
-        return $this->getSetting('force_generate')
-                // -> last config?!
-            || $this->db()->countActivitiesSinceLastDeployedConfig() > 0;
+        return $this->getSetting('force_generate') === 'y'
+            || ! $this->configForLatestActivityExists();
+    }
+
+    protected function configForLatestActivityExists()
+    {
+        $db = $this->db();
+
+        return IcingaConfig::exists(
+            DirectorDeploymentLog::loadLatest($db)->getConfigHexChecksum(),
+            $db
+        );
     }
 
     protected function shouldDeploy(IcingaConfig $config)



More information about the icinga-checkins mailing list