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:
@@ -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')}")
|
||||
|
||||
Reference in New Issue
Block a user