[icinga-checkins] icinga.org: icingaweb2-module-director/feature-ddo-playground: DdoDb: initial import...

git at icinga.org git at icinga.org
Tue Jun 21 12:06:22 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jun 21 12:05:54 2016 +0200

DdoDb: initial import...

...also provide $this->ddo() in DdoCommand implementations

---

 library/Director/Cli/DdoCommand.php |   24 ++++++++++++++++++++++++
 library/Director/Ddo/DdoDb.php      |   10 ++++++++++
 2 files changed, 34 insertions(+)

diff --git a/library/Director/Cli/DdoCommand.php b/library/Director/Cli/DdoCommand.php
new file mode 100644
index 0000000..d77f875
--- /dev/null
+++ b/library/Director/Cli/DdoCommand.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Icinga\Module\Director\Cli;
+
+use Icinga\Module\Director\Ddo\DdoDb;
+
+class DdoCommand extends Command
+{
+    private $ddo;
+
+    protected function ddo()
+    {
+        if ($this->ddo === null) {
+            $resourceName = $this->Config()->get('ddo', 'resource');
+            if ($resourceName) {
+                $this->ddo = DdoDb::fromResourceName($resourceName);
+            } else {
+                $this->fail('DDO is not configured correctly');
+            }
+        }
+
+        return $this->ddo;
+    }
+}
diff --git a/library/Director/Ddo/DdoDb.php b/library/Director/Ddo/DdoDb.php
new file mode 100644
index 0000000..6feaf7a
--- /dev/null
+++ b/library/Director/Ddo/DdoDb.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace Icinga\Module\Director\Ddo;
+
+
+use Icinga\Data\Db\DbConnection;
+
+class DdoDb extends DbConnection
+{
+}



More information about the icinga-checkins mailing list