fix: installer tolerates localized 'service exists' (1073) and restarts the service if an upgrade step fails; 1.1.7

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
gti
2026-09-24 11:13:19 -03:00
co-authored by Claude Sonnet 5
parent 55e858e261
commit f5f05d87e6
21 changed files with 68 additions and 29 deletions
+9 -4
View File
@@ -142,10 +142,15 @@ def upgrade_flow(*, install_dir_path: str | None = None, progress: Callable[[str
progress("Atualizando o Agent (identidade e credenciais preservadas)…")
if common.service_installed():
common.ensure_service_stopped()
extract_payload(install)
common.upgrade_agent_env(install, version)
common.install_service(install)
common.write_arp_uninstall(install)
try:
extract_payload(install)
common.upgrade_agent_env(install, version)
common.install_service(install)
common.write_arp_uninstall(install)
except Exception as error: # noqa: BLE001 — never leave the host without a running Agent because an upgrade step failed
common.ilog(f"upgrade step failed: {error!r}; restarting the existing service")
common.start_and_verify(attempts=2)
raise
os.environ["AGENT_VERSION"] = version
progress("Iniciando o serviço…")
common.ilog(f"upgrade to {version} from {existing.get('agent_id')}")