summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/rest.c b/src/rest.c
index f4b5918..647458e 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -3710,7 +3710,7 @@ static int og_cmd_add_image(json_t *element, struct og_msg_params *params,
char repository_ip[OG_DB_IP_MAXLEN + 1];
char new_image_id[OG_DB_INT_MAXLEN + 1];
struct og_dbi *dbi;
- json_t *clients;
+ json_t *body;
int err = 0;
bool found;
@@ -3766,20 +3766,19 @@ static int og_cmd_add_image(json_t *element, struct og_msg_params *params,
}
json_object_set_new(element, "id", json_string(params->id));
- clients = json_copy(element);
- json_object_del(clients, "clients");
-
err = og_dbi_get_repository_ip(dbi, params->image.repo_id,
params->ips_array[0], repository_ip);
og_dbi_close(dbi);
if (err < 0)
return err;
- json_object_set_new(clients ,"repository", json_string(repository_ip));
- json_object_set_new(clients ,"backup", json_boolean(params->backup));
+ body = json_copy(element);
+ json_object_del(body, "clients");
+ json_object_set_new(body, "repository", json_string(repository_ip));
+ json_object_set_new(body, "backup", json_boolean(params->backup));
return og_send_request(OG_METHOD_POST, OG_CMD_IMAGE_CREATE, params,
- clients);
+ body);
}
static int og_cmd_create_image(json_t *element, struct og_msg_params *params)