diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-07-29 13:14:44 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-07-29 20:25:26 +0200 |
commit | bb992f97f3c29373cc109efa0b974accf682c47a (patch) | |
tree | a20e9bb89d6c5dd79247371b40cbb83c3b64a975 | |
parent | 4221a82c7a25efdca601dffa62a0de1850de8976 (diff) |
#993 Send REST request in createBootMode(...)
This patch replaces a call to the 'setclientmode' script in
createBootMode() function for a REST request to the ogServer.
-rw-r--r-- | admin/WebConsole/includes/restfunctions.php | 10 | ||||
-rw-r--r-- | admin/WebConsole/includes/tftputils.php | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php index 88e486ac..1ec43744 100644 --- a/admin/WebConsole/includes/restfunctions.php +++ b/admin/WebConsole/includes/restfunctions.php @@ -31,6 +31,7 @@ define('OG_REST_CMD_CREATE_SCHEDULE', 'schedule/create'); define('OG_REST_CMD_DELETE_SCHEDULE', 'schedule/delete'); define('OG_REST_CMD_UPDATE_SCHEDULE', 'schedule/update'); define('OG_REST_CMD_GET_SCHEDULE', 'schedule/get'); +define('OG_REST_CMD_MODES', 'modes'); define('OG_REST_PARAM_CLIENTS', 'clients'); define('OG_REST_PARAM_ADDR', 'addr'); @@ -75,6 +76,8 @@ define('OG_REST_PARAM_DAYS', 'days'); define('OG_REST_PARAM_HOURS', 'hours'); define('OG_REST_PARAM_AM_PM', 'am_pm'); define('OG_REST_PARAM_MINUTES', 'minutes'); +define('OG_REST_PARAM_MODE', 'mode'); +define('OG_REST_PARAM_SCOPE_NAME', 'scope_name'); define('TYPE_COMMAND', 1); define('TYPE_PROCEDURE', 2); @@ -227,6 +230,13 @@ function session($string_ips, $params) { common_request(OG_REST_CMD_SESSION, POST, $data); } +function set_mode($scope_name, $mode) { + $data = array(OG_REST_PARAM_SCOPE_NAME => $scope_name, + OG_REST_PARAM_MODE => $mode); + + common_request(OG_REST_CMD_MODES, POST, $data); +} + function create_image($string_ips, $params) { preg_match_all('/(?<=\=)(.*?)(?=\r)/', $params, $matches); diff --git a/admin/WebConsole/includes/tftputils.php b/admin/WebConsole/includes/tftputils.php index aca054a5..d5d857a2 100644 --- a/admin/WebConsole/includes/tftputils.php +++ b/admin/WebConsole/includes/tftputils.php @@ -10,6 +10,7 @@ // Ficheros de inclusión. include_once("../includes/ctrlacc.php"); include_once("../clases/AdoPhp.php"); +include_once("../includes/restfunctions.php"); // Directorio de ficheros PXE. define("PXEDIRBIOS", "/opt/opengnsys/tftpboot/menu.lst"); @@ -97,8 +98,7 @@ function createBootMode ($cmd, $bootopt, $hostname, $lang) { // Descripción plantilla PXE $description=exec("awk 'NR==1 {print $2}' ".PXEDIRBIOS."/templates/".$bootopt); if ($description === "") $description=exec("awk 'NR==1 {print $2}' ".PXEDIRUEFI."/templates/".$bootopt); - // Llamamos al script setclientmode - shell_exec("export LANG=$lang $acceso; /opt/opengnsys/bin/setclientmode $description $hostname PERM"); + set_mode($hostname, $bootopt); } |