summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-08-23 16:01:08 +0200
committerSebastian Wagner2011-08-23 16:01:08 +0200
commit575a4ad60592a9616924c9ba6a63dcf2da0dbc51 (patch)
tree37a323b30fecb15d9d8c1c4434ec09659c869ade /application
parentsome calendar changes (diff)
parentminor (diff)
downloadpoolctrl-575a4ad60592a9616924c9ba6a63dcf2da0dbc51.tar.gz
poolctrl-575a4ad60592a9616924c9ba6a63dcf2da0dbc51.tar.xz
poolctrl-575a4ad60592a9616924c9ba6a63dcf2da0dbc51.zip
Merge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl
Diffstat (limited to 'application')
-rw-r--r--application/configs/application.ini.dist8
-rw-r--r--application/controllers/EventController.php56
-rw-r--r--application/controllers/GearmanController.php6
3 files changed, 49 insertions, 21 deletions
diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist
index 0f0e9b9..813d3c3 100644
--- a/application/configs/application.ini.dist
+++ b/application/configs/application.ini.dist
@@ -36,6 +36,14 @@ gearman.server.host =
gearman.server.port =
gearman.worker.waitTime = 120
gearman.worker.updateRate = 1
+gearman.worker.ps.blacklist.0 = firefox-bin
+gearman.worker.ps.blacklist.1 = chromium-browse
+gearman.worker.ps.blacklist.2 = thunderbird-bi
+gearman.worker.ps.blacklist.3 = evince
+gearman.worker.ps.blacklist.4 = soffice.bin
+gearman.worker.ps.blacklist.5 = eclipse
+gearman.worker.ps.whitelist.0 = gnome-screensav
+gearman.worker.ps.whitelist.1 = Kscreensaver
event.updatePeriod = 5
[staging : production]
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index cdce29d..c606179 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -596,6 +596,8 @@ class EventController extends Zend_Controller_Action
'waitTime' => $this->gearmanWorkerWaitTime,
'host' => $this->gearmanServerHost,
'port' => $this->gearmanServerPort,
+ 'blacklist' => $this->config['gearman']['worker']['ps']['blacklist'],
+ 'whitelist' => $this->config['gearman']['worker']['ps']['whitelist'],
);
$poolRequest = "poolid=" . $event->getPbs_poolID();
$this->config['pbs2']['getpools'];
@@ -692,12 +694,10 @@ class EventController extends Zend_Controller_Action
}
}
}
- if(count($results)) {
- $resultString = json_encode($results);
- } else {
+ if(count($results) <= 0) {
$results = array("No current events available");
- $resultString = json_encode($results);
}
+ $resultString = json_encode($results);
header('Content-Type: application/json');
header('Content-Disposition: inline; filename="result.json"');
header('Pragma: no-cache');
@@ -709,14 +709,18 @@ class EventController extends Zend_Controller_Action
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- $events = $this->eventMapper->findBy(array('running' => 1));
+ $eventreportMapper = new Application_Model_EventreportMapper();
$eventtypeMapper = new Application_Model_EventtypeMapper();
- $result = $eventtypeMapper->findBy(array("title" => "boot"));
- $eventtypeBoot = $result[0];
- $result = $eventtypeMapper->findBy(array("title" => "shutdown"));
- $eventtypeShutdown = $result[0];
$eventBootNames = array();
$eventShutdownNames = array();
+ $results = array();
+ $result1 = $eventtypeMapper->findBy(array("title" => "boot"));
+ $result2 = $eventtypeMapper->findBy(array("title" => "shutdown"));
+ $eventtypeBoot = $result1[0];
+ $eventtypeShutdown = $result2[0];
+ $resultShortcutName = 'result shortcut';
+ $errorsName = 'clients errors';
+ $events = $this->eventMapper->findBy(array('running' => 1));
foreach($events as $event) {
if($event->getRunningtype() == $eventtypeBoot->getID()) {
@@ -726,8 +730,6 @@ class EventController extends Zend_Controller_Action
}
}
- $eventreportMapper = new Application_Model_EventreportMapper();
-
if(count($eventBootNames) > 0) {
$data = array(
'type' => 'boot',
@@ -742,18 +744,20 @@ class EventController extends Zend_Controller_Action
exit;
}
$bootResultDecode = json_decode($bootResult);
+ $results['boot results'] = $bootResultDecode;
foreach($bootResultDecode as $k => $eventResult) {
- $eventResult->result = sprintf('%s', $eventResult->result);
- if($eventResult->result == "not finished" || $eventResult->result = 'not founded') {
+
+ $eventResult->$resultShortcutName = sprintf('%s', $eventResult->$resultShortcutName);
+ if($eventResult->$resultShortcutName == "not finished" || $eventResult->$resultShortcutName = 'not founded') {
continue;
}
$result = $this->eventMapper->findBy(array("title" => $k));
$event = $result[0];
$eventreport = new Application_Model_Eventreport();
$eventreport->setEventID($event->getID());
- $eventreport->setResult($eventResult->result);
- if($eventResult->result == "failed") {
- $eventreport->setErrors(json_encode($eventResult->errors));
+ $eventreport->setResult($eventResult->$resultShortcutName);
+ if($eventResult->$resultShortcutName == "failed") {
+ $eventreport->setErrors(json_encode($eventResult->$errorsName));
}
$eventreport->setType($eventtypeBoot->getID());
try {
@@ -791,18 +795,19 @@ class EventController extends Zend_Controller_Action
exit;
}
$shutdownResultDecode = json_decode($shutdownResult);
+ $results['shutdown results'] = $shutdownResultDecode;
foreach($shutdownResultDecode as $k => $eventResult) {
- $eventResult->result = sprintf('%s', $eventResult->result);
- if($eventResult->result == "not finished" || $eventResult->result = 'not founded') {
+ $eventResult->$resultShortcutName = sprintf('%s', $eventResult->$resultShortcutName);
+ if($eventResult->$resultShortcutName == "not finished" || $eventResult->$resultShortcutName = 'not founded') {
continue;
}
$result = $this->eventMapper->findBy(array("title" => $k));
$event = $result[0];
$eventreport = new Application_Model_Eventreport();
$eventreport->setEventID($event->getID());
- $eventreport->setResult($eventResult->result);
- if($eventResult->result == 'failed') {
- $eventreport->setErrors(json_encode($eventResult->errors));
+ $eventreport->setResult($eventResult->$resultShortcutName);
+ if($eventResult->$resultShortcutName == "failed") {
+ $eventreport->setErrors(json_encode($eventResult->$errorsName));
}
$eventreport->setType($eventtypeShutdown->getID());
try {
@@ -825,5 +830,14 @@ class EventController extends Zend_Controller_Action
}
}
}
+ if(count($results) <= 0) {
+ $results = array("No current events available");
+ }
+ $resultString = json_encode($results);
+ header('Content-Type: application/json');
+ header('Content-Disposition: inline; filename="result.json"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+ echo $resultString;
}
} \ No newline at end of file
diff --git a/application/controllers/GearmanController.php b/application/controllers/GearmanController.php
index 8e0252f..6c77511 100644
--- a/application/controllers/GearmanController.php
+++ b/application/controllers/GearmanController.php
@@ -107,6 +107,8 @@ class GearmanController extends Zend_Controller_Action
'waitTime' => $this->gearmanWorkerWaitTime,
'host' => $this->gearmanServerHost,
'port' => $this->gearmanServerPort,
+ 'blacklist' => $this->config['gearman']['worker']['ps']['blacklist'],
+ 'whitelist' => $this->config['gearman']['worker']['ps']['whitelist'],
'clients' => array(
0 => array('id' => '1', 'ip' =>'132.230.4.24', 'mac' =>'00:13:72:C7:FD:A1'),
),
@@ -130,6 +132,8 @@ class GearmanController extends Zend_Controller_Action
'waitTime' => $this->gearmanWorkerWaitTime,
'host' => $this->gearmanServerHost,
'port' => $this->gearmanServerPort,
+ 'blacklist' => $this->config['gearman']['worker']['ps']['blacklist'],
+ 'whitelist' => $this->config['gearman']['worker']['ps']['whitelist'],
'clients' => array(
0 => array('id' => '1', 'ip' =>'132.230.4.24', 'mac' =>'00:13:72:C7:FD:A1'),
),
@@ -153,6 +157,8 @@ class GearmanController extends Zend_Controller_Action
'waitTime' => $this->gearmanWorkerWaitTime,
'host' => $this->gearmanServerHost,
'port' => $this->gearmanServerPort,
+ 'blacklist' => $this->config['gearman']['worker']['ps']['blacklist'],
+ 'whitelist' => $this->config['gearman']['worker']['ps']['whitelist'],
'clients' => array(
0 => array('id' => '1', 'ip' =>'132.230.4.121', 'mac' =>'00:1e:0b:a6:f8:19'),
0 => array('id' => '2', 'ip' =>'132.230.4.122', 'mac' =>'00:1e:0b:a6:d5:de'),