diff options
author | Simon Rettberg | 2017-11-03 13:20:19 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-03 13:20:19 +0100 |
commit | ab8046f57ad7e42dfd9faf596fc5a3045d9c27a1 (patch) | |
tree | d4be35c9beb917fb0e10b4706c9a0a048d8c2313 /modules-available/rebootcontrol/inc/rebootcontrol.inc.php | |
parent | [inc/module] Fix sorting bug, show errors in debug mode, add optional param t... (diff) | |
download | slx-admin-ab8046f57ad7e42dfd9faf596fc5a3045d9c27a1.tar.gz slx-admin-ab8046f57ad7e42dfd9faf596fc5a3045d9c27a1.tar.xz slx-admin-ab8046f57ad7e42dfd9faf596fc5a3045d9c27a1.zip |
[rebootcontrol] Move reboot function to helper class
Diffstat (limited to 'modules-available/rebootcontrol/inc/rebootcontrol.inc.php')
-rw-r--r-- | modules-available/rebootcontrol/inc/rebootcontrol.inc.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php new file mode 100644 index 00000000..789552cd --- /dev/null +++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php @@ -0,0 +1,30 @@ +<?php + +class RebootControl +{ + + /** + * @param string[] $uuids List of machineuuids to reboot + * @return false|array task struct for the reboot job + */ + public static function reboot($uuids) + { + $list = RebootQueries::getMachinesByUuid($uuids); + if (empty($list)) + return false; + return self::execute($list, false, 0, 0); + } + + public static function execute($list, $shutdown, $minutes, $locationId) + { + return Taskmanager::submit("RemoteReboot", array( + "clients" => $list, + "shutdown" => $shutdown, + "minutes" => $minutes, + "locationId" => $locationId, + "sshkey" => SSHKey::getPrivateKey(), + "port" => 9922, // Hard-coded, must match mgmt-sshd module + )); + } + +}
\ No newline at end of file |