[icinga-checkins] icinga.org: icingaweb2-module-director/feature/job-scheduling-11627: Db: provide enumDeployedConfigs

git at icinga.org git at icinga.org
Mon May 2 10:45:14 CEST 2016


Module: icingaweb2-module-director
Branch: feature/job-scheduling-11627
Commit: d5e021658c52f0514e8e3439d85fcfcf3e50ef4d
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=d5e021658c52f0514e8e3439d85fcfcf3e50ef4d

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon May  2 10:45:04 2016 +0200

Db: provide enumDeployedConfigs

---

 library/Director/Db.php |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/library/Director/Db.php b/library/Director/Db.php
index 4d099d0..5217d46 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -789,6 +789,32 @@ class Db extends DbConnection
         return $binary;
     }
 
+    public function enumDeployedConfigs()
+    {
+        $db = $this->db();
+
+        $columns = array(
+            'checksum' => $this->dbHexFunc('c.checksum'),
+        );
+
+        if ($this->isPgsql()) {
+            $columns['caption'] = 'SUBSTRING(' . $columns['checksum'] . ' FROM 1 FOR 7)';
+        } else {
+            $columns['caption'] = 'SUBSTRING(' . $columns['checksum'] . ', 1, 7)';
+        }
+
+        $query = $db->select()->from(
+            array('l' => 'director_deployment_log'),
+            $columns
+        )->joinLeft(
+            array('c' => 'director_generated_config'),
+            'c.checksum = l.config_checksum',
+            array()
+        )->order('l.start_time DESC');
+
+        return $db->fetchPairs($query);
+    }
+
     public function getUncollectedDeployments()
     {
         $db = $this->db();



More information about the icinga-checkins mailing list