From e67cdafb719fc5701f5652b7af028779fc364a82 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Thu, 7 Nov 2024 18:43:45 +0100 Subject: client: no need to update repository id after creating image this repository id is already added to the database when the image creation is requested, remove this code to update it again when the client replies --- src/client.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'src/client.c') diff --git a/src/client.c b/src/client.c index 18a3784..3422ad0 100644 --- a/src/client.c +++ b/src/client.c @@ -906,38 +906,10 @@ static bool og_dbi_update_image(struct og_dbi *dbi, const struct og_image_legacy *img_info, const char *computer_id) { - int repo_id, sw_id, repo_alias; const char *msglog; dbi_result result; uint32_t revision; - - /* find repository identifier by repository ip and computer ID. */ - result = dbi_conn_queryf(dbi->conn, - "SELECT repositorios.idrepositorio, repositorios.alias" - " FROM repositorios" - " LEFT JOIN ordenadores USING (idrepositorio)" - " WHERE repositorios.ip='%s' AND ordenadores.idordenador=%s", - img_info->repo, computer_id); - if (!result) { - dbi_conn_error(dbi->conn, &msglog); - syslog(LOG_ERR, "failed to query database (%s:%d) %s\n", - __func__, __LINE__, msglog); - return false; - } - if (!dbi_result_next_row(result)) { - syslog(LOG_ERR, - "repository does not exist in database (%s:%d)\n", - __func__, __LINE__); - dbi_result_free(result); - return false; - } - repo_alias = dbi_result_get_uint(result, "alias"); - if (repo_alias) - repo_id = repo_alias; - else - repo_id = dbi_result_get_uint(result, "idrepositorio"); - - dbi_result_free(result); + int sw_id; /* find software id by computer ID, disk number and partition. */ result = dbi_conn_queryf(dbi->conn, @@ -965,11 +937,11 @@ static bool og_dbi_update_image(struct og_dbi *dbi, result = dbi_conn_queryf(dbi->conn, "UPDATE imagenes" " SET idordenador=%s, numdisk=%s, numpar=%s, codpar=%s," - " idperfilsoft=%d, idrepositorio=%d," + " idperfilsoft=%d, " " fechacreacion=NOW(), revision=revision+1" " WHERE idimagen=%s", computer_id, img_info->disk, img_info->part, img_info->code, - sw_id, repo_id, img_info->image_id); + sw_id, img_info->image_id); if (!result) { dbi_conn_error(dbi->conn, &msglog); -- cgit v1.2.3-18-g5258