pull/42/head
Nicolas Arenas 2025-09-01 12:19:23 +02:00
parent 597f0a156b
commit 4301fb4635
2 changed files with 11 additions and 6 deletions

View File

@ -1343,7 +1343,7 @@ def create_torrent_sum():
# Si la imagen no existe, retornamos un error y salimos del endpoint:
if image_exists == False:
journal.send("Image not found", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
journal.send("{'component':'ogRepo', 'severity':'WARNING', 'http_code':'400', 'operation':'Run endpoint create_torrent_sum', 'desc':'Warning: Image not found'}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api")
journal.send(f"{{'component':'ogRepo', 'severity':'WARNING', 'http_code':'400', 'operation':'Run endpoint create_torrent_sum', 'desc':'Warning: Image {image_name} not found'}}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api")
return jsonify({
"success": False,
"details": f"{repo_path}{image_name} Image not found"
@ -1352,7 +1352,7 @@ def create_torrent_sum():
# Chequeamos que el archivo checked.info existe y si no existe devolvemos error y salimos del endpoint:
if not check_file_exists(f"{repo_path}{image_name}.info.checked"):
journal.send("Checked info file not found", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
journal.send("{'component':'ogRepo', 'severity':'WARNING', 'http_code':'400', 'operation':'Run endpoint create_torrent_sum', 'desc':'Warning: Checked info file not found'}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api")
journal.send(f"{{'component':'ogRepo', 'severity':'WARNING', 'http_code':'400', 'operation':'Run endpoint create_torrent_sum', 'desc':'Warning: Checked info file for image: {image_name}.info.checked not found'}}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api")
return jsonify({
"success": False,
"details": f"{repo_path}{image_name}.info.checked file not found"

View File

@ -184,11 +184,16 @@ def main():
# Obtenemos la ruta completa de la imagen:
file_path = build_file_path()
# Si no existe el archivo de imagen, imprimimos un mensaje de error y salimos del script:
if not os.path.exists(file_path):
journal.send("createTorrentSum.py: Image not found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print("Image file doesn't exist")
# Si no existe el archivo de imagen o el .info, imprimimos un mensaje de error y salimos del script:
if not os.path.exists(file_path) or not os.path.exists(f"{file_path}.info.checked"):
if not os.path.exists(file_path):
journal.send(f"createTorrentSum.py: Image file '{file_path}' not found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Image file '{file_path}' doesn't exist")
if not os.path.exists(f"{file_path}.info.checked"):
journal.send(f"createTorrentSum.py: Info file '{file_path}.info.checked' not found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
print(f"Info file '{file_path}.info.checked' doesn't exist")
sys.exit(2)
# Si la imagen está bloqueada, imprimimos un mensaje de error y salimos del script:
if os.path.exists(f"{file_path}.lock"):