summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-07-19 13:05:11 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-07-19 14:20:16 +0200
commita67c0d3d5756642373097261bc503f18f123e933 (patch)
treef923895e3dc49129904ae11f5e8ac1e2ad19790b /src/rest.c
parent075725b1feef20a0cec4ef8affdf792aba2d6e23 (diff)
dbi: use repository_id field if front-end offers it
If repository_id json field is provided, use it to narrow down the image lookup. After this, search use this same repository ID to fetch the IP address. Old web console may not provide repository_id, infer it from the image name. Always set image id field for creation and update.
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rest.c b/src/rest.c
index 708d53a..6ccb97b 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -3737,17 +3737,17 @@ static int og_cmd_add_image(json_t *element, struct og_msg_params *params,
snprintf(new_image_id, sizeof(new_image_id), "%lu", params->image.id);
params->id = new_image_id;
- json_object_set_new(element, "id", json_string(params->id));
} else {
syslog(LOG_INFO, "updating existing image `%s'\n", params->image.name);
snprintf(new_image_id, sizeof(new_image_id), "%lu", params->image.id);
params->id = new_image_id;
}
+ 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, atoll(params->id), repository_ip);
+ err = og_dbi_get_repository_ip(dbi, params->image.repo_id, repository_ip);
og_dbi_close(dbi);
if (err < 0)
return err;