[icinga-checkins] icinga.org: icingaweb2-module-director/master: JobsCommand: really run also single jobs

git at icinga.org git at icinga.org
Tue Jun 28 14:35:29 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jun 28 14:35:03 2016 +0200

JobsCommand: really run also single jobs

---

 application/clicommands/JobsCommand.php |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/application/clicommands/JobsCommand.php b/application/clicommands/JobsCommand.php
index 40e8bcf..567e688 100644
--- a/application/clicommands/JobsCommand.php
+++ b/application/clicommands/JobsCommand.php
@@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Clicommands;
 
 use Icinga\Module\Director\Cli\Command;
 use Icinga\Module\Director\Job\JobRunner;
+use Icinga\Module\Director\Objects\DirectorJob;
 use Icinga\Module\Director\Objects\ImportSource;
 use Icinga\Module\Director\Objects\SyncRule;
 use Icinga\Module\Director\IcingaConfig\IcingaConfig;
@@ -18,10 +19,11 @@ class JobsCommand extends Command
     public function runAction()
     {
         $forever = $this->params->shift('forever');
-        $job = $this->params->shift();
-        if ($job) {
-            echo "Running (theoretically) $job\n";
-            return;
+        $jobId = $this->params->shift();
+        if ($jobId) {
+            $job = DirectorJob::load($jobId, $this->db());
+            $job->run();
+            exit(0);
         }
 
         if ($forever) {



More information about the icinga-checkins mailing list