summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
authorSimon Rettberg2020-04-16 12:34:54 +0200
committerSimon Rettberg2020-04-16 12:34:54 +0200
commited648ff94381d566e5e8eb2f7c31800acba2d28e (patch)
treebbffb179da53e6f6775c39aa0ecebfc504862821 /modules-available/rebootcontrol
parent[statistics] Make sort order in client list match the location tree (diff)
downloadslx-admin-ed648ff94381d566e5e8eb2f7c31800acba2d28e.tar.gz
slx-admin-ed648ff94381d566e5e8eb2f7c31800acba2d28e.tar.xz
slx-admin-ed648ff94381d566e5e8eb2f7c31800acba2d28e.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.
Diffstat (limited to 'modules-available/rebootcontrol')
-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;