From 5fc9b9ca232b7f50232104484a653846850c18b8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 16 Apr 2020 12:34:54 +0200 Subject: [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. --- modules-available/rebootcontrol/inc/rebootcontrol.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-55-g7522