From de47feab4323287c827a16c2ba2b9f120326f860 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 13 May 2021 18:08:38 -0700 Subject: [PATCH] scripts: Fix check for services running when upgrading. When upgrading from a pre-4.0 release, scripts/stop-server logic would check whether supervisord configuration files were present to determine what it needed to restart, but only considered paths to those files that are introduced in Zulip 4.0. Fixed #18493. --- scripts/lib/zulip_tools.py | 16 +++++++++++++++- scripts/restart-server | 3 ++- scripts/stop-server | 10 ++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py index 35f710858b..b096b91b3d 100755 --- a/scripts/lib/zulip_tools.py +++ b/scripts/lib/zulip_tools.py @@ -600,7 +600,21 @@ def is_vagrant_env_host(path: str) -> bool: def has_application_server() -> bool: - return os.path.exists("/etc/supervisor/conf.d/zulip/zulip.conf") + return ( + # Current path + os.path.exists("/etc/supervisor/conf.d/zulip/zulip.conf") + # Old path, relevant for upgrades + or os.path.exists("/etc/supervisor/conf.d/zulip.conf") + ) + + +def has_process_fts_updates() -> bool: + return ( + # Current path + os.path.exists("/etc/supervisor/conf.d/zulip/zulip_db.conf") + # Old path, relevant for upgrades + or os.path.exists("/etc/supervisor/conf.d/zulip_db.conf") + ) def deport(netloc: str) -> str: diff --git a/scripts/restart-server b/scripts/restart-server index 3f4ec89c13..d3a489eca1 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -17,6 +17,7 @@ from scripts.lib.zulip_tools import ( get_config_file, get_tornado_ports, has_application_server, + has_process_fts_updates, overwrite_symlink, ) @@ -90,7 +91,7 @@ if has_application_server(): worker_status.check_returncode() workers.extend(status_line.split()[0] for status_line in worker_status.stdout.splitlines()) -if os.path.exists("/etc/supervisor/conf.d/zulip/zulip_db.conf"): +if has_process_fts_updates(): workers.append("process-fts-updates") if action == "restart" and len(workers) > 0: diff --git a/scripts/stop-server b/scripts/stop-server index a91c62f94e..0588403d99 100755 --- a/scripts/stop-server +++ b/scripts/stop-server @@ -7,7 +7,13 @@ import sys import time sys.path.append(os.path.join(os.path.dirname(__file__), "..")) -from scripts.lib.zulip_tools import ENDC, OKGREEN, WARNING, has_application_server +from scripts.lib.zulip_tools import ( + ENDC, + OKGREEN, + WARNING, + has_application_server, + has_process_fts_updates, +) deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) os.chdir(deploy_path) @@ -22,7 +28,7 @@ logging.basicConfig(format="%(asctime)s stop-server: %(message)s", level=logging services = [] # Start with the least-critical services: -if os.path.exists("/etc/supervisor/conf.d/zulip/zulip_db.conf"): +if has_process_fts_updates(): services.append("process-fts-updates") if has_application_server():