From 7e89fa354fa7ca9989523a7a1d02e9fbf21f9907 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 30 Jul 2026 03:49:56 +0000 Subject: [PATCH] =?UTF-8?q?[FIX]=20install:=20propager=20l'=C3=A9chec=20au?= =?UTF-8?q?=20code=20de=20sortie=20(faux=20=E2=9C=85=20du=20suivi=20corrig?= =?UTF-8?q?=C3=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update_env_version.py (cible « make install_odoo_XX ») calculait un statut mais ne faisait JAMAIS sys.exit() et IGNORAIT le retour de update_environment() (l'install réelle : venv/poetry). Résultat : même quand install_locally.sh échouait (ex. poetry status 127), le script sortait 0 -> make 0 -> remote « && » continuait (service créé) -> __ERPLIBRE_EXIT__ 0 -> le suivi d'installation affichait ✅ à tort. - main() suit un exit_code : install_system() ou update_environment() renvoyant une valeur non nulle (os.system : 0 = succès) -> exit_code=1. - sys.exit(main() or 0) propage réellement l'échec. - Étapes post-install (pycharm, git_repo_update, generate_config) exécutées seulement si l'install a réussi (sinon .venv.erplibre absent -> cascade d'erreurs). Chaîne désormais complète : install_locally.sh exit 1 -> install_locally_ dev.sh exit 1 -> os.system != 0 -> install_erplibre != 0 -> update_environment != 0 -> main exit_code=1 -> sys.exit(1) -> make échoue -> remote && stoppe -> __ERPLIBRE_EXIT__ != 0 -> dashboard ❌. Co-Authored-By: Claude Opus 4.8 (1M context) --- script/version/update_env_version.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/script/version/update_env_version.py b/script/version/update_env_version.py index 154913b..5f7d6e5 100755 --- a/script/version/update_env_version.py +++ b/script/version/update_env_version.py @@ -709,6 +709,11 @@ def main(): update.validate_version() _logger.info("Validate environment") + # exit_code : propagé à sys.exit() -> une install qui ÉCHOUE renvoie un + # code non nul (avant, main() ne sortait jamais en erreur : le suivi + # d'installation affichait ✅ même quand poetry/pyenv plantaient). + # Rappel os.system : 0 = succès ; toute autre valeur = échec. + exit_code = 0 status = 0 if ( update.config.install_dev @@ -718,16 +723,22 @@ def main(): status = update.validate_environment() if update.config.install: status = update.install_system() + if status not in (0, True, None): + exit_code = 1 if ( update.config.force_install or update.config.install_dev or update.config.partial_install or update.config.is_in_switch ) and not status: - update.update_environment() + rc = update.update_environment() + if rc not in (0, True, None): + exit_code = 1 update.print_log() - if update.config.install_dev: + # Étapes post-install : uniquement si l'installation a RÉUSSI (sinon + # .venv.erplibre est absent -> cascade d'erreurs inutiles). + if update.config.install_dev and exit_code == 0: # Update pycharm configuration update.pycharm_update() @@ -736,6 +747,8 @@ def main(): "./.venv.erplibre/bin/python ./script/git/git_repo_update_group.py" ) os.system("./script/generate_config.sh") + + return exit_code # TODO ignore this if installation fail # TODO this cause an error at first execution, need to source ./.venv.erplibre/bin/activate and rerun @@ -756,4 +769,4 @@ def die(cond, message, code=1): if __name__ == "__main__": - main() + sys.exit(main() or 0)