summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2019-01-17 14:41:44 +0100
committerSimon Rettberg2019-01-17 14:41:44 +0100
commit07b7dcd4d08be00541dcbd4a92a02f267a0b162c (patch)
tree19ed8195313ff5af353c256350c03b0e01d16f6e /inc
parent[serversetup-bwlp] Respect overriden default entry for location menu (diff)
downloadslx-admin-07b7dcd4d08be00541dcbd4a92a02f267a0b162c.tar.gz
slx-admin-07b7dcd4d08be00541dcbd4a92a02f267a0b162c.tar.xz
slx-admin-07b7dcd4d08be00541dcbd4a92a02f267a0b162c.zip
[serversetup-bwlp] Make ipxe trigger a hook for modularity
Diffstat (limited to 'inc')
-rw-r--r--inc/trigger.inc.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index 93f57236..8a130aca 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -20,13 +20,23 @@ class Trigger
*/
public static function ipxe()
{
- $data = Property::getBootMenu();
- $data['ipaddress'] = Property::getServerIp();
- $task = Taskmanager::submit('CompileIPxe', $data);
- if (!isset($task['id']))
- return false;
- Property::set('ipxe-task-id', $task['id'], 15);
- return $task['id'];
+ $hooks = Hook::load('ipxe-update');
+ $taskId = false;
+ foreach ($hooks as $hook) {
+ $ret = (function($taskId) use ($hook) {
+ $ret = include_once($hook->file);
+ if (is_string($ret))
+ return $ret;
+ return isset($taskId) ? $taskId : false;
+ })($taskId);
+ if (is_string($ret)) {
+ $taskId = $ret;
+ } elseif (is_array($ret) && isset($ret['id'])) {
+ $taskId = $ret['id'];
+ }
+ }
+ Property::set('ipxe-task-id', $taskId, 15);
+ return $taskId;
}
/**