mirror of https://git.48k.eu/ogserver
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 repliesmaster
parent
24e70ac3ff
commit
e67cdafb71
34
src/client.c
34
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);
|
||||
|
|
Loading…
Reference in New Issue