summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/pages/exec.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol/pages/exec.inc.php')
-rw-r--r--modules-available/rebootcontrol/pages/exec.inc.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules-available/rebootcontrol/pages/exec.inc.php b/modules-available/rebootcontrol/pages/exec.inc.php
index 0c40c313..e5fe3cd8 100644
--- a/modules-available/rebootcontrol/pages/exec.inc.php
+++ b/modules-available/rebootcontrol/pages/exec.inc.php
@@ -13,12 +13,11 @@ class SubPage
private static function execExec()
{
- $id = Request::post('id', Request::REQUIRED, 'int');
- $machines = Session::get('exec-' . $id);
- if (!is_array($machines)) {
- Message::addError('unknown-exec-job', $id);
+ $uuids = array_values(Request::post('uuid', Request::REQUIRED, 'array'));
+ $machines = RebootUtils::getFilteredMachineList($uuids, 'action.exec');
+ if (empty($machines))
return;
- }
+ RebootUtils::sortRunningFirst($machines);
$script = preg_replace('/\r\n?/', "\n", Request::post('script', Request::REQUIRED, 'string'));
$task = RebootControl::runScript($machines, $script);
if (Taskmanager::isTask($task)) {
@@ -46,6 +45,8 @@ class SubPage
Message::addError('unknown-exec-job', $id);
return;
}
+ Session::set('exec-' . $id, false);
+ Session::save();
Render::addTemplate('exec-enter-command', ['clients' => $machines, 'id' => $id]);
}