client: stub to parse size field in /image/create response from client

Still incomplete, src/schema.c needs to be update to add a new field to the
'imagenes' table in the database.
master
OpenGnSys Support Team 2023-12-12 11:28:57 +01:00
parent 721ab28fdf
commit e3b8f3d2f9
1 changed files with 6 additions and 3 deletions

View File

@ -499,7 +499,8 @@ static int og_resp_refresh(json_t *data, struct og_client *cli)
static int update_image_info(struct og_dbi *dbi, const char *image_id, static int update_image_info(struct og_dbi *dbi, const char *image_id,
const char *clonator, const char *compressor, const char *clonator, const char *compressor,
const char *filesystem, const uint64_t datasize) const char *filesystem, const uint64_t datasize,
uint64_t size)
{ {
const char *msglog; const char *msglog;
dbi_result result; dbi_result result;
@ -527,6 +528,7 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
struct og_software_legacy soft_legacy; struct og_software_legacy soft_legacy;
struct og_image_legacy img_legacy; struct og_image_legacy img_legacy;
struct og_computer computer = {}; struct og_computer computer = {};
uint64_t datasize = 0, size = 0;
const char *compressor = NULL; const char *compressor = NULL;
const char *filesystem = NULL; const char *filesystem = NULL;
const char *partition = NULL; const char *partition = NULL;
@ -537,7 +539,6 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
const char *code = NULL; const char *code = NULL;
const char *name = NULL; const char *name = NULL;
const char *repo = NULL; const char *repo = NULL;
uint64_t datasize = 0;
struct og_dbi *dbi; struct og_dbi *dbi;
const char *key; const char *key;
json_t *value; json_t *value;
@ -570,6 +571,8 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
err = og_json_parse_string(value, &filesystem); err = og_json_parse_string(value, &filesystem);
else if (!strcmp(key, "datasize")) else if (!strcmp(key, "datasize"))
err = og_json_parse_uint64(value, &datasize); err = og_json_parse_uint64(value, &datasize);
else if (!strcmp(key, "size"))
err = og_json_parse_uint64(value, &size);
if (err < 0) if (err < 0)
return err; return err;
@ -633,7 +636,7 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
} }
res = update_image_info(dbi, image_id, clonator, compressor, res = update_image_info(dbi, image_id, clonator, compressor,
filesystem, datasize); filesystem, datasize, size);
og_dbi_close(dbi); og_dbi_close(dbi);
if (res) { if (res) {