parent
1256229340
commit
8611995dda
|
@ -1350,12 +1350,19 @@ def create_torrent_sum():
|
|||
}), 400
|
||||
|
||||
# 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"):
|
||||
missed_files = []
|
||||
if not check_file_exists(f"{repo_path}{image_name}.info.checked") and not check_file_exists(f"{repo_path}{image_name}.info"):
|
||||
if not check_file_exists(f"{repo_path}{image_name}.info.checked"):
|
||||
missed_files.append(f"{repo_path}{image_name}.info.checked")
|
||||
if not check_file_exists(f"{repo_path}{image_name}.info"):
|
||||
missed_files.append(f"{repo_path}{image_name}.info")
|
||||
|
||||
if missed_files:
|
||||
journal.send("Checked info file not found", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||
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"
|
||||
"details": f"{missed_files} not found"
|
||||
}), 400
|
||||
|
||||
# Construimos la ruta de la imagen (relativa a "repo_path"):
|
||||
|
|
|
@ -185,13 +185,13 @@ def main():
|
|||
file_path = build_file_path()
|
||||
|
||||
# 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) or not (os.path.exists(f"{file_path}.info.checked") or os.path.exists(f"{file_path}.info")):
|
||||
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")
|
||||
if not os.path.exists(f"{file_path}.info.checked") and not os.path.exists(f"{file_path}.info"):
|
||||
journal.send(f"createTorrentSum.py: Neither '{file_path}.info.checked' nor '{file_path}.info' found", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||
print(f"Neither info file '{file_path}.info.checked' nor '{file_path}.info' exists")
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
|
@ -262,7 +262,8 @@ def main():
|
|||
# Actualizamos la información del repositorio, ejecutando el script "updateRepoInfo.py":
|
||||
journal.send("createTorrentSum.py: Updating repository info...", PRIORITY=journal.LOG_INFO, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||
print("Updating Repository Info...")
|
||||
update_repo_info()
|
||||
if os.path.exists(f"{file_path}.info"):
|
||||
update_repo_info()
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue