summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2016-09-29 09:30:26 +0000
committerramon <ramongomez@us.es>2016-09-29 09:30:26 +0000
commit208ee5055eccb8726ad78e1e52103a2a6fbfbdcc (patch)
treef54802efbb65c202c2fd2249e8c98c1395bbfcff /admin
parent353c112529fec25f127b4977e1a74e98eabc6995 (diff)
#708: Corregir erratas en salida de estado de cliente iniciado en sistema operativo con OGAgent y en salida de datos de imagen mostrando si está actualizada.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5020 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin')
-rw-r--r--admin/WebConsole/rest/server.php36
1 files changed, 17 insertions, 19 deletions
diff --git a/admin/WebConsole/rest/server.php b/admin/WebConsole/rest/server.php
index 633eb169..a5b955f2 100644
--- a/admin/WebConsole/rest/server.php
+++ b/admin/WebConsole/rest/server.php
@@ -503,7 +503,8 @@ $app->get('/ous/:ouid/labs/:labid/clients/:clntid/diskcfg', 'validateApiKey',
$cmd->texto = <<<EOD
SELECT ordenadores.idordenador AS clientid, ordenadores.nombreordenador,
ordenadores_particiones.*, tipospar.tipopar,
- sistemasficheros.nemonico, nombresos.nombreso, imagenes.nombreca
+ sistemasficheros.nemonico, nombresos.nombreso, imagenes.nombreca,
+ (imagenes.revision - ordenadores_particiones.revision) AS difimagen
FROM ordenadores_particiones
RIGHT JOIN ordenadores USING(idordenador)
LEFT JOIN tipospar USING(codpar)
@@ -571,6 +572,13 @@ $app->get('/ous/:ouid/labs/:labid/clients/:clntid/status', 'validateApiKey',
global $LONCABECERA;
global $LONHEXPRM;
+ // Status mapping.
+ $status = array('OFF'=>"off",
+ 'INI'=>"initializing",
+ 'OPG'=>"ogclient",
+ 'BSY'=>"busy",
+ 'LNX'=>"linux",
+ 'WIN'=>"windows");
// Parameters.
$ouid = htmlspecialchars($ouid);
$labid = htmlspecialchars($labid);
@@ -625,36 +633,26 @@ EOD;
$stat = array();
preg_match('/\/[A-Z]*;/', $values["tso"], $stat);
// Check if data exists.
- if (empty($stat[0]) or preg_match('/OFF/',$stat[0])) {
+ if (empty($stat[0]) or preg_match('/OFF/', $stat[0])) {
// If no data, check OGAgent API connection.
$url = "https://$clientip:8000/opengnsys/status";
$result = multiRequest(Array($url), array(CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false));
if (empty($result[0])) {
// Client is off.
- $response['status'] = "off";
+ $response['status'] = $status['OFF'];
} else {
- // Get status data.
+ // Get status and session data.
$data = json_decode($result[0]);
- if (isset($data->status)) {
- $response['status'] = $data->status;
+ if (isset($status[$data->status])) {
+ $response['status'] = $status[$data->status];
$response['loggedin'] = $data->loggedin;
- } else {
- // Unknown status.
- $response['status'] = "unknown";
}
}
} else {
- // Status mapping.
- $status = array('OFF'=>"off",
- 'INI'=>"initializing",
- 'OPG'=>"ogclient",
- 'BSY'=>"busy",
- 'LNX'=>"linux",
- 'WIN'=>"windows");
$response['status'] = $status[substr($stat[0], 1, 3)];
- if (empty($response['status'])) {
- $response['status'] = "unknown";
- }
+ }
+ if (empty($response['status'])) {
+ $response['status'] = "unknown";
}
jsonResponse(200, $response);
}