summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-12-10 18:18:28 +0100
committerSimon Rettberg2019-12-10 18:18:28 +0100
commitb497d4a7200591e0b7b91948120cbfa395f5c92f (patch)
tree6e384142228882f422a3766c8e8598034f323dc2 /modules-available/rebootcontrol/inc/rebootcontrol.inc.php
parent[rebootcontrol] Fix jumphost script template (missing %) (diff)
downloadslx-admin-b497d4a7200591e0b7b91948120cbfa395f5c92f.tar.gz
slx-admin-b497d4a7200591e0b7b91948120cbfa395f5c92f.tar.xz
slx-admin-b497d4a7200591e0b7b91948120cbfa395f5c92f.zip
[statistics/rebootcontrol] Add remote exec UI
Diffstat (limited to 'modules-available/rebootcontrol/inc/rebootcontrol.inc.php')
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index 489b0252..667c8bbd 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -21,7 +21,7 @@ class RebootControl
*/
public static function reboot($uuids, $kexec = false)
{
- $list = RebootQueries::getMachinesByUuid($uuids);
+ $list = RebootUtils::getMachinesByUuid($uuids);
if (empty($list))
return false;
return self::execute($list, $kexec ? RebootControl::KEXEC_REBOOT : RebootControl::REBOOT, 0);
@@ -501,4 +501,18 @@ class RebootControl
$subnet['iclients'] = array_slice($subnet['iclients'], 0, 3);
}
+ public static function prepareExec()
+ {
+ User::assertPermission('action.exec');
+ $uuids = array_values(Request::post('uuid', Request::REQUIRED, 'array'));
+ $machines = RebootUtils::getFilteredMachineList($uuids, 'action.exec');
+ if ($machines === false)
+ return;
+ RebootUtils::sortRunningFirst($machines);
+ $id = mt_rand();
+ Session::set('exec-' . $id, $machines, 60);
+ Session::save();
+ Util::redirect('?do=rebootcontrol&show=exec&what=prepare&id=' . $id);
+ }
+
}