summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorsebastian wagner2011-09-12 15:34:07 +0200
committersebastian wagner2011-09-12 15:34:07 +0200
commit8e25f8208cca2ce9eb8bef9b30a7e7dc3c3cbdcc (patch)
tree95268fef1048e92c193804565d2b91a820406280 /application
parentbug fix (diff)
parentweitere Korrektur (diff)
downloadpoolctrl-8e25f8208cca2ce9eb8bef9b30a7e7dc3c3cbdcc.tar.gz
poolctrl-8e25f8208cca2ce9eb8bef9b30a7e7dc3c3cbdcc.tar.xz
poolctrl-8e25f8208cca2ce9eb8bef9b30a7e7dc3c3cbdcc.zip
Merge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl
Diffstat (limited to 'application')
-rwxr-xr-xapplication/configs/application.ini.dist19
-rwxr-xr-xapplication/controllers/EventController.php24
-rwxr-xr-xapplication/controllers/GearmanController.php24
3 files changed, 14 insertions, 53 deletions
diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist
index 3acfdbc..46d9759 100755
--- a/application/configs/application.ini.dist
+++ b/application/configs/application.ini.dist
@@ -32,24 +32,17 @@ pbs2.getperson = /resource/getperson/apikey/
pbs2.getmembership = /resource/getmembership/apikey/
pbs2.getgroup = /resource/getgroup/apikey/
pbs2.getrole = /resource/getrole/apikey/
+poolctrl.host =
+poolctrl.runevent = /event/run/apikey/apikey1
+poolctrl.reportevent = /event/report/apikey/apikey1
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.blacklist.6 = acroread
-gearman.worker.ps.blacklist.7 = libreoffice
-gearman.worker.ps.blacklist.8 = vmplayer-daemo
-gearman.worker.ps.blacklist.9 = vmware-unity-he
-gearman.worker.ps.blacklist.10 = vmware-vmx
-gearman.worker.ps.whitelist.0 = gnome-screensav
-gearman.worker.ps.whitelist.1 = Kscreensaver
+gearman.worker.ps.blacklist = firefox-bin, chromium-browse, thunderbird-bi, evince, soffice.bin, eclipse
+gearman.worker.ps.whitelist = gnome-screensav, Kscreensaver
event.updatePeriod = 5
+event.lookbacktime = 1
event.category.default = Lecture
[staging : production]
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 5fd110b..53c5d21 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -36,7 +36,6 @@ class EventController extends Zend_Controller_Action
$apikey = $this->_request->getParam('apikey');
}
if($apikey != ""){
- $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $apikey, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$bootstrap = $this->getInvokeArg('bootstrap');
$this->config = $bootstrap->getOptions();
$this->pbs2host = $this->config['pbs2']['host'];
@@ -48,6 +47,7 @@ class EventController extends Zend_Controller_Action
$this->gearmanClient->addServer($this->gearmanServerHost);
$this->eventMapper = new Application_Model_EventMapper();
$this->eventcategoryMapper = new Application_Model_EventcategoryMapper();
+ $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $apikey, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
} else {
header('HTTP/1.0 401 No apikey is set');
die();
@@ -323,7 +323,7 @@ class EventController extends Zend_Controller_Action
$filterentriesID3 = sprintf("%s", $filterentriesXML3->filterentry->id);
}
if($params['immediate']) {
- $this->runEvent($event);
+ $event->setRunning(true);
} else {
$event->setRunning(false);
}
@@ -335,6 +335,9 @@ class EventController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
+ if($params['immediate']) {
+ $this->runEvent($event);
+ }
$this->_redirect('/event/');
}
}
@@ -685,9 +688,10 @@ class EventController extends Zend_Controller_Action
}
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- $startTime = time() - 60;
+ $lookbacktime = $this->config['event']['lookbacktime'];
+ $startTime = time() - $lookbacktime * 60;
$updatePeriod = $this->config['event']['updatePeriod'];
- $endTime = $startTime + 60 + $updatePeriod * 60;
+ $endTime = $startTime + $lookbacktime * 60 + $updatePeriod * 60;
$eventlist = $this->eventMapper->fetchAll();
$eventcategoryMapper = new Application_Model_EventcategoryMapper();
$result = $eventcategoryMapper->fetchAll();
@@ -745,12 +749,6 @@ class EventController extends Zend_Controller_Action
if($run) {
$data = array(
'eventName' => $event->getTitle(),
- 'updateRate' => $this->gearmanWorkerUpdateRate,
- 'waitTime' => $this->gearmanWorkerWaitTime,
- 'gearmanServerHost' => $this->gearmanServerHost,
- 'gearmanServerPort' => $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'];
@@ -1025,12 +1023,6 @@ class EventController extends Zend_Controller_Action
private function runEvent(Application_Model_Event $event) {
$data = array(
'eventName' => $event->getTitle(),
- 'updateRate' => $this->gearmanWorkerUpdateRate,
- 'waitTime' => $this->gearmanWorkerWaitTime,
- 'gearmanServerHost' => $this->gearmanServerHost,
- 'gearmanServerPort' => $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'];
diff --git a/application/controllers/GearmanController.php b/application/controllers/GearmanController.php
index b4b8f6c..5882add 100755
--- a/application/controllers/GearmanController.php
+++ b/application/controllers/GearmanController.php
@@ -8,9 +8,6 @@ class GearmanController extends Zend_Controller_Action
protected $acl;
protected $gearmanClient;
protected $gearmanServerHost;
- protected $gearmanServerPort;
- protected $gearmanWorkerUpdateRate;
- protected $gearmanWorkerWaitTime;
public function init()
{
@@ -26,10 +23,7 @@ class GearmanController extends Zend_Controller_Action
header('HTTP/1.0 403 No Right to run events');
die();
}
- $this->gearmanServerPort = $this->config['gearman']['server']['port'];
$this->gearmanServerHost = $this->config['gearman']['server']['host'];
- $this->gearmanWorkerWaitTime = $this->config['gearman']['worker']['waitTime'];
- $this->gearmanWorkerUpdateRate = $this->config['gearman']['worker']['updateRate'];
$this->gearmanClient = new GearmanClient();
$this->gearmanClient->addServer($this->gearmanServerHost);
} else {
@@ -106,12 +100,6 @@ class GearmanController extends Zend_Controller_Action
$data = array(
'eventName' => $eventName,
'eventOS' => $eventOS,
- 'updateRate' => $this->gearmanWorkerUpdateRate,
- 'waitTime' => $this->gearmanWorkerWaitTime,
- 'gearmanServerHost' => $this->gearmanServerHost,
- 'gearmanServerPort' => $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'),
),
@@ -131,12 +119,6 @@ class GearmanController extends Zend_Controller_Action
$eventName = 'shutdownTest';
$data = array(
'eventName' => $eventName,
- 'updateRate' => $this->gearmanWorkerUpdateRate,
- 'waitTime' => $this->gearmanWorkerWaitTime,
- 'gearmanServerHost' => $this->gearmanServerHost,
- 'gearmanServerPort' => $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'),
),
@@ -156,12 +138,6 @@ class GearmanController extends Zend_Controller_Action
$eventName = 'maintenance_pool-113'; //maintenance of pool-113
$data = array(
'eventName' => $eventName,
- 'updateRate' => $this->gearmanWorkerUpdateRate,
- 'waitTime' => $this->gearmanWorkerWaitTime,
- 'gearmanServerHost' => $this->gearmanServerHost,
- 'gearmanServerPort' => $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'),