summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2014-11-26 21:01:37 +0100
committerSimon Rettberg2014-11-26 21:01:37 +0100
commit177791970ee86a6653b051ee393801ad37134d70 (patch)
tree696fd696c89d4d587365fa7172ab0e184e183f07 /inc
parentAdd HTTPS config module for webif, update everything to use FileUtil class, m... (diff)
downloadslx-admin-177791970ee86a6653b051ee393801ad37134d70.tar.gz
slx-admin-177791970ee86a6653b051ee393801ad37134d70.tar.xz
slx-admin-177791970ee86a6653b051ee393801ad37134d70.zip
Lots of small bugfixes, proxy config WIP, https config WIP, translation updates, added masterpassword to pxe menu, ...
Diffstat (limited to 'inc')
-rw-r--r--inc/event.inc.php22
-rw-r--r--inc/property.inc.php9
-rw-r--r--inc/taskmanager.inc.php14
-rw-r--r--inc/trigger.inc.php8
-rw-r--r--inc/validator.inc.php2
5 files changed, 30 insertions, 25 deletions
diff --git a/inc/event.inc.php b/inc/event.inc.php
index 376deb6f..95d75e33 100644
--- a/inc/event.inc.php
+++ b/inc/event.inc.php
@@ -26,8 +26,7 @@ class Event
$mountId = Trigger::mount();
$autoIp = Trigger::autoUpdateServerIp();
$ldadpId = Trigger::ldadp();
- $ipxeId = Trigger::ipxe();
-
+
Taskmanager::submit('DozmodLauncher', array(
'operation' => 'start'
));
@@ -60,23 +59,12 @@ class Event
EventLog::failure("The server's IP address could not be determined automatically, and there is no valid address configured.");
$everythingFine = false;
}
- // iPXE generation
- if ($ipxeId === false) {
- EventLog::failure('Cannot generate PXE menu: Taskmanager unreachable!');
- $everythingFine = false;
- } else {
- $res = Taskmanager::waitComplete($ipxeId, 5000);
- if (Taskmanager::isFailed($res)) {
- EventLog::failure('Update PXE Menu failed', $res['data']['error']);
- $everythingFine = false;
- }
- }
// Just so we know booting is done (and we don't expect any more errors from booting up)
if ($everythingFine) {
EventLog::info('Bootup finished without errors.');
} else {
- EventLog::info('There were errors during bootup. Maybe the server is not fully configured yet.');
+ EventLog::warning('There were errors during bootup. Maybe the server is not fully configured yet.');
}
}
@@ -85,9 +73,11 @@ class Event
*/
public static function serverIpChanged()
{
- Trigger::rebuildAdModules();
+ global $tidAdModules, $tidIpxe;
+ $tidAdModules = Trigger::rebuildAdModules();
+ $tidIpxe = Trigger::ipxe();
}
-
+
/**
* The activated configuration changed.
*/
diff --git a/inc/property.inc.php b/inc/property.inc.php
index afbdf0de..dd70b8d4 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -59,9 +59,10 @@ class Property
public static function setServerIp($value)
{
- if ($value !== self::getServerIp())
- Event::serverIpChanged();
+ if ($value === self::getServerIp())
+ return false;
self::set('server-ip', $value);
+ Event::serverIpChanged();
}
public static function getBootMenu()
@@ -159,12 +160,12 @@ class Property
{
return self::get('last-warn-event-id', 0);
}
-
+
public static function setNeedsSetup($value)
{
self::set('needs-setup', $value);
}
-
+
public static function getNeedsSetup()
{
return self::get('needs-setup');
diff --git a/inc/taskmanager.inc.php b/inc/taskmanager.inc.php
index 528b3f78..dd16c62d 100644
--- a/inc/taskmanager.inc.php
+++ b/inc/taskmanager.inc.php
@@ -80,6 +80,20 @@ class Taskmanager
}
/**
+ * Checks whether the given task id corresponds to a known task in the taskmanager.
+ * Returns true iff the taskmanager is reachable and the status of the task
+ * is different from NO_SUCH_TASK.
+ *
+ * @param string $taskid a task id
+ * @return boolean true if taskid exists in taskmanager
+ */
+ public static function isTask($taskid)
+ {
+ $task = self::status($taskid);
+ return isset($task['statusCode']) && $task['statusCode'] !== NO_SUCH_TASK;
+ }
+
+ /**
* Wait for the given task's completion.
*
* @param type $task task to wait for
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index ce56c815..790323b5 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -15,12 +15,12 @@ class Trigger
* Compile iPXE pxelinux menu. Needs to be done whenever the server's IP
* address changes.
*
- * @param boolean $force force recompilation even if it seems up to date
- * @return boolean|string true if already up to date, false if launching task failed, task-id otherwise
+ * @return boolean|string false if launching task failed, task-id otherwise
*/
public static function ipxe()
{
$data = Property::getBootMenu();
+ $data['ipaddress'] = Property::getServerIp();
$task = Taskmanager::submit('CompileIPxe', $data);
if (!isset($task['id']))
return false;
@@ -155,7 +155,7 @@ class Trigger
'password' => $vmstore['cifspasswd']
));
}
-
+
/**
* Check and process all callbacks
*/
@@ -214,7 +214,7 @@ class Trigger
}
return $parent;
}
-
+
public static function startDaemons($parent, &$taskids)
{
$parent = self::triggerDaemons('start', $parent, $taskids);
diff --git a/inc/validator.inc.php b/inc/validator.inc.php
index 944ac2ef..20b843d7 100644
--- a/inc/validator.inc.php
+++ b/inc/validator.inc.php
@@ -40,7 +40,7 @@ class Validator
{
if (empty($value))
return '';
- if (preg_match('/^\$6\$.+\$./', $value))
+ if (preg_match('/^\$[156]\$.+\$./', $value))
return $value;
return Crypto::hash6($value);
}