summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-11-07 18:43:45 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-11-07 18:52:07 +0100
commite67cdafb719fc5701f5652b7af028779fc364a82 (patch)
tree29a695b0b5d2b572dc41d42fdcbd094f11c0367e /src/client.c
parent24e70ac3ff167f0d8342e57252fc737083ae02ab (diff)
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
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c34
1 files changed, 3 insertions, 31 deletions
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);