summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2019-10-10 13:15:57 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-10-11 11:57:08 +0200
commit45389c50210706ef250bac4402554a7aed7ec699 (patch)
tree3a2d436572550cea325318de348b64b44c5526de /admin/WebConsole
parentca96a723d15d86ed5856b36d35b889724fa64528 (diff)
#915 Adapt web to use new REST API "image/create/incremental" command
SocketHidra command has been replaced by POST "image/create/incremental".
Diffstat (limited to 'admin/WebConsole')
-rw-r--r--admin/WebConsole/comandos/gestores/gestor_Comandos.php5
-rw-r--r--admin/WebConsole/includes/restfunctions.php48
2 files changed, 53 insertions, 0 deletions
diff --git a/admin/WebConsole/comandos/gestores/gestor_Comandos.php b/admin/WebConsole/comandos/gestores/gestor_Comandos.php
index 5b951735..70b3019d 100644
--- a/admin/WebConsole/comandos/gestores/gestor_Comandos.php
+++ b/admin/WebConsole/comandos/gestores/gestor_Comandos.php
@@ -33,6 +33,7 @@ define('OG_CMD_ID_SESSION', 9);
define('OG_CMD_ID_SETUP', 10);
define('OG_CMD_ID_CREATE_BASIC_IMAGE', 12);
define('OG_CMD_ID_RESTORE_BASIC_IMAGE', 13);
+define('OG_CMD_ID_CREATE_INCREMENTAL_IMAGE', 14);
define('OG_CMD_ID_SENDMESSAGE', 16);
// Recoge parametros de seguimiento
@@ -143,6 +144,9 @@ switch ($idcomando) {
case OG_CMD_ID_CREATE_BASIC_IMAGE:
create_basic_image($cadenaip, $atributos);
break;
+ case OG_CMD_ID_CREATE_INCREMENTAL_IMAGE:
+ create_incremental_image($cadenaip, $atributos);
+ break;
case OG_CMD_ID_RESTORE_BASIC_IMAGE:
restore_basic_image($cadenaip, $atributos);
break;
@@ -226,6 +230,7 @@ if($sw_ejya=='on' || $sw_ejprg=="on" ){
$idcomando != OG_CMD_ID_SETUP &&
$idcomando != OG_CMD_ID_SESSION &&
$idcomando != OG_CMD_ID_CREATE_BASIC_IMAGE &&
+ $idcomando != OG_CMD_ID_CREATE_INCREMENTAL_IMAGE &&
$idcomando != OG_CMD_ID_RESTORE_BASIC_IMAGE &&
$idcomando != OG_CMD_ID_POWEROFF &&
$idcomando != OG_CMD_ID_HARDWARE &&
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php
index 65fcbe99..285d2ba1 100644
--- a/admin/WebConsole/includes/restfunctions.php
+++ b/admin/WebConsole/includes/restfunctions.php
@@ -22,6 +22,7 @@ define('OG_REST_CMD_CREATE_IMAGE', 'image/create');
define('OG_REST_CMD_RESTORE_IMAGE', 'image/restore');
define('OG_REST_CMD_SETUP', 'image/setup');
define('OG_REST_CMD_CREATE_BASIC_IMAGE', 'image/create/basic');
+define('OG_REST_CMD_CREATE_INCREMENTAL_IMAGE', 'image/create/incremental');
define('OG_REST_CMD_RESTORE_BASIC_IMAGE', 'image/restore/basic');
define('OG_REST_PARAM_CLIENTS', 'clients');
@@ -55,6 +56,8 @@ define('OG_REST_PARAM_CACHE', 'cache');
define('OG_REST_PARAM_CLEANUP_CACHE', 'cleanup_cache');
define('OG_REST_PARAM_REMOVE_DST', 'remove_dst');
define('OG_REST_PARAM_PATH', 'path');
+define('OG_REST_PARAM_DIFF_ID', 'diff_id');
+define('OG_REST_PARAM_DIFF_NAME', 'diff_name');
define('OG_REST_PARAM_METHOD', 'method');
$conf_file = parse_ini_file(__DIR__ . '/../../etc/ogAdmRepo.cfg');
@@ -274,6 +277,51 @@ function create_basic_image($string_ips, $params) {
common_request(OG_REST_CMD_CREATE_BASIC_IMAGE, POST, $data);
}
+function create_incremental_image($string_ips, $params) {
+
+ preg_match_all('/(?<=\=)[^\r]*(?=\r)?/', $params, $matches);
+
+ $ips = explode(';',$string_ips);
+ $disk = $matches[0][0];
+ $part = $matches[0][1];
+ $id = $matches[0][2];
+ $name = $matches[0][3];
+ $repos = $matches[0][4];
+ $diff_id = $matches[0][5];
+ $diff_name = $matches[0][6];
+ $path = $matches[0][7];
+ $sync = $matches[0][8];
+ $diff = $matches[0][9];
+ $remove = $matches[0][10];
+ $compress = $matches[0][11];
+ $cleanup = $matches[0][12];
+ $cache = $matches[0][13];
+ $cleanup_cache = $matches[0][14];
+ $remove_dst = $matches[0][15];
+
+ $data = array(OG_REST_PARAM_CLIENTS => $ips,
+ OG_REST_PARAM_DISK => $disk,
+ OG_REST_PARAM_PART => $part,
+ OG_REST_PARAM_ID => $id,
+ OG_REST_PARAM_NAME => $name,
+ OG_REST_PARAM_REPOS => $repos,
+ OG_REST_PARAM_SYNC_PARAMS => array(
+ OG_REST_PARAM_SYNC => $sync,
+ OG_REST_PARAM_PATH => $path,
+ OG_REST_PARAM_DIFF => $diff,
+ OG_REST_PARAM_DIFF_ID => $diff_id,
+ OG_REST_PARAM_DIFF_NAME => $diff_name,
+ OG_REST_PARAM_REMOVE => $remove,
+ OG_REST_PARAM_COMPRESS => $compress,
+ OG_REST_PARAM_CLEANUP => $cleanup,
+ OG_REST_PARAM_CACHE => $cache,
+ OG_REST_PARAM_CLEANUP_CACHE => $cleanup_cache,
+ OG_REST_PARAM_REMOVE_DST => $remove_dst)
+ );
+
+ common_request(OG_REST_CMD_CREATE_INCREMENTAL_IMAGE, POST, $data);
+}
+
function restore_basic_image($string_ips, $params) {
preg_match_all('/(?<=\=)[^\r]*(?=\r)?/', $params, $matches);