diff options
Diffstat (limited to 'inc/event.inc.php')
-rw-r--r-- | inc/event.inc.php | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/inc/event.inc.php b/inc/event.inc.php index 16e5323a..4d02b580 100644 --- a/inc/event.inc.php +++ b/inc/event.inc.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * Class with static functions that are called when a specific event * took place, like the server has been booted, or the interface address @@ -15,7 +17,7 @@ class Event * Called when the system (re)booted. Could be implemented * by a @reboot entry in crontab (running as the same user php does) */ - public static function systemBooted() + public static function systemBooted(): void { EventLog::info('System boot...'); $everythingFine = true; @@ -41,42 +43,30 @@ class Event // Tasks: fire away $mountStatus = false; $mountId = Trigger::mount(); - $ldadpId = Trigger::ldadp(); $ipxeId = Trigger::ipxe(); // Check status of all tasks // Mount vm store - if ($mountId === false) { + if ($mountId === null) { EventLog::info('No VM store type defined.'); $everythingFine = false; } else { $mountStatus = Taskmanager::waitComplete($mountId, 5000); } - // LDAP AD Proxy - if ($ldadpId === false) { - EventLog::failure('Cannot start LDAP-AD-Proxy: Taskmanager unreachable!'); - $everythingFine = false; - } else { - $res = Taskmanager::waitComplete($ldadpId, 5000); - if (Taskmanager::isFailed($res)) { - EventLog::failure('Starting LDAP-AD-Proxy failed', $res['data']['messages']); - $everythingFine = false; - } - } // Primary IP address if (!$autoIp) { 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) { + if ($ipxeId === null) { 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']); + EventLog::failure('Update PXE Menu failed', $res['data']['error'] ?? $res['statusCode'] ?? ''); $everythingFine = false; } } @@ -90,10 +80,10 @@ class Event $mountId = Trigger::mount(); $mountStatus = Taskmanager::waitComplete($mountId, 10000); } - if ($mountId !== false && Taskmanager::isFailed($mountStatus)) { - EventLog::failure('Mounting VM store failed', $mountStatus['data']['messages']); + if ($mountId !== null && Taskmanager::isFailed($mountStatus)) { + EventLog::failure('Mounting VM store failed', $mountStatus['data']['messages'] ?? ''); $everythingFine = false; - } elseif ($mountId !== false && !Taskmanager::isFinished($mountStatus)) { + } elseif ($mountId !== null && !Taskmanager::isFinished($mountStatus)) { // TODO: Still running - create callback } @@ -108,7 +98,7 @@ class Event /** * Server's primary IP address changed. */ - public static function serverIpChanged() + public static function serverIpChanged(): void { Trigger::ipxe(); if (Module::isAvailable('sysconfig')) { // TODO: Modularize events @@ -116,15 +106,5 @@ class Event } } - /** - * The activated configuration changed. - */ - public static function activeConfigChanged() - { - $task = Trigger::ldadp(); - if ($task === false) - return; - TaskmanagerCallback::addCallback($task, 'ldadpStartup'); - } } |