summaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-10-11 13:24:57 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-10-11 13:45:15 +0200
commit61bbcd9251093a6359634f24b49427c72d633786 (patch)
tree057f30c0be5341c5df6ba5773eae2956a5fb6855 /sources
parent90672e4a255f56d206d5ea885daf634761b06b18 (diff)
#915 Fix POST "software" cmd in ogAdmServer and web
This patch adds the parameters "disk" and "partition" to POST "software" command. This way the client can create a software profile without failure. New request: POST /software { "clients":[ "192.168.56.12" ], "disk":"1", "partition":"1" } Reply: 200 OK
Diffstat (limited to 'sources')
-rw-r--r--sources/ogAdmServer.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp
index e2bd4c1..53f46a8 100644
--- a/sources/ogAdmServer.cpp
+++ b/sources/ogAdmServer.cpp
@@ -3894,9 +3894,11 @@ static int og_cmd_hardware(json_t *element, struct og_msg_params *params)
static int og_cmd_software(json_t *element, struct og_msg_params *params)
{
+ char buf[4096] = {};
+ int err = 0, len;
const char *key;
json_t *value;
- int err = 0;
+ TRAMA *msg;
if (json_typeof(element) != JSON_OBJECT)
return -1;
@@ -3904,13 +3906,29 @@ static int og_cmd_software(json_t *element, struct og_msg_params *params)
json_object_foreach(element, key, value) {
if (!strcmp(key, "clients"))
err = og_json_parse_clients(value, params);
+ else if (!strcmp(key, "disk"))
+ err = og_json_parse_string(value, &params->disk);
+ else if (!strcmp(key, "partition"))
+ err = og_json_parse_string(value, &params->partition);
if (err < 0)
break;
}
- return og_cmd_legacy_send(params, "InventarioSoftware",
- CLIENTE_OCUPADO);
+ len = snprintf(buf, sizeof(buf),
+ "nfn=InventarioSoftware\rdsk=%s\rpar=%s\r",
+ params->disk, params->partition);
+
+ msg = og_msg_alloc(buf, len);
+ if (!msg)
+ return -1;
+
+ og_send_cmd((char **)params->ips_array, params->ips_array_len,
+ CLIENTE_OCUPADO, msg);
+
+ og_msg_free(msg);
+
+ return 0;
}
static int og_cmd_create_image(json_t *element, struct og_msg_params *params)