summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-04-16 12:34:54 +0200
committerSimon Rettberg2020-05-07 13:31:18 +0200
commit5fc9b9ca232b7f50232104484a653846850c18b8 (patch)
tree3206f02039297b87fb8c4e6b0ff97a26ecb2bf56
parent[roomplanner] Disable logout timeout for dedicated manager (diff)
downloadslx-admin-5fc9b9ca232b7f50232104484a653846850c18b8.tar.gz
slx-admin-5fc9b9ca232b7f50232104484a653846850c18b8.tar.xz
slx-admin-5fc9b9ca232b7f50232104484a653846850c18b8.zip
[rebootcontrol] wakeMachines(): Return machines that can't be reached
A clumsy way to return a list of machines we can't wake, since their subnet is not reachable. This is required for the upcoming remoteaccess module, since it needs to know how many machines it could actually wake up. This needs some proper refactoring anyways, but we either need separate functions for building a wakeup plan and actually executing it, or change this method so it takes a binch of machines, but you can specify after how many machines it can actually reach, it should just stop and return.
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index abbef0c9..4c668e53 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -307,7 +307,7 @@ class RebootControl
* @param array $list list of clients containing each keys 'macaddr' and 'clientip'
* @return string id of this job
*/
- public static function wakeMachines($list)
+ public static function wakeMachines($list, &$failed = [])
{
/* TODO: Refactor mom's spaghetti
* Now that I figured out what I want, do something like this:
@@ -449,6 +449,7 @@ class RebootControl
$ips = ArrayUtil::flattenByKey($unknown, 'clientip');
$errors .= "**** WARNING ****\nThe following clients do not belong to a known subnet (bug?)\n" . implode("\n", $ips) . "\n";
}
+ $failed = array_merge($bad, $unknown);
$id = Util::randomUuid();
self::addTask($id, self::TASK_WOL, $list, $tasks, ['log' => $errors]);
return $id;