summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-11-26 11:18:36 +0100
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-11-27 14:06:29 +0100
commit00d54325d3d8a325ebcab40df549b4146204f6e0 (patch)
tree2db39fc4818bf151110556569dcb187a46ef51ef
parent113472d5c0115d53d2fb99288759502d196a8e93 (diff)
rest: update POST /shell/run for cmd executionv1.2.5-27
Remove legacy "echo" parameter. Add boolean "inline" parameter to determine if the execution is an inline command or a predefined script in /opt/opengnsys/shell/
-rw-r--r--src/json.h1
-rw-r--r--src/rest.c11
2 files changed, 6 insertions, 6 deletions
diff --git a/src/json.h b/src/json.h
index 1d711dd..6536d88 100644
--- a/src/json.h
+++ b/src/json.h
@@ -75,7 +75,6 @@ struct og_msg_params {
const char *cache;
const char *cache_size;
const char *comment;
- bool echo;
struct og_partition partition_setup[OG_PARTITION_MAX];
struct og_image image;
uint64_t flags;
diff --git a/src/rest.c b/src/rest.c
index db6f829..cf50f64 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -65,7 +65,7 @@ struct ev_loop *og_loop;
#define OG_REST_PARAM_SYNC_DIFF_NAME (1UL << 27)
#define OG_REST_PARAM_SYNC_PATH (1UL << 28)
#define OG_REST_PARAM_SYNC_METHOD (1UL << 29)
-#define OG_REST_PARAM_ECHO (1UL << 30)
+#define OG_REST_PARAM_INLINE (1UL << 30)
#define OG_REST_PARAM_TASK (1UL << 31)
#define OG_REST_PARAM_TIME_YEARS (1UL << 32)
#define OG_REST_PARAM_TIME_MONTHS (1UL << 33)
@@ -667,6 +667,7 @@ static int og_cmd_run_post(json_t *element, struct og_msg_params *params)
{
json_t *value, *clients;
const char *key;
+ bool inline_cmd;
int err = 0;
if (json_typeof(element) != JSON_OBJECT)
@@ -677,9 +678,9 @@ static int og_cmd_run_post(json_t *element, struct og_msg_params *params)
err = og_json_parse_clients(value, params);
else if (!strcmp(key, "run"))
err = og_json_parse_run(value, params);
- else if (!strcmp(key, "echo")) {
- err = og_json_parse_bool(value, &params->echo);
- params->flags |= OG_REST_PARAM_ECHO;
+ else if (!strcmp(key, "inline")) {
+ err = og_json_parse_bool(value, &inline_cmd);
+ params->flags |= OG_REST_PARAM_INLINE;
}
if (err < 0)
@@ -688,7 +689,7 @@ static int og_cmd_run_post(json_t *element, struct og_msg_params *params)
if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR |
OG_REST_PARAM_RUN_CMD |
- OG_REST_PARAM_ECHO))
+ OG_REST_PARAM_INLINE))
return -1;
clients = json_copy(element);