Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

restart-server: Default to running config and database checks.

Alex Vandiverf5f6a3789baf
diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2
index da69a39b573..feab25655f2 100755
--- a/scripts/lib/upgrade-zulip-stage-2
+++ b/scripts/lib/upgrade-zulip-stage-2
@@ -363,7 +363,8 @@ else:
# Perform system checks -- including database checks, so we don't need
# to do them when we do migrations, below.
-subprocess.check_call(["./manage.py", "check", "--database", "default"], preexec_fn=su_to_zulip)
+if not args.skip_checks:
+ subprocess.check_call(["./manage.py", "check", "--database", "default"], preexec_fn=su_to_zulip)
# Our next optimization is to check whether any migrations are needed
# before we start the critical section of the restart. This saves
@@ -465,7 +466,7 @@ else:
)
logging.info("Restarting Zulip...")
- start_args = []
+ start_args = ["--skip-checks"]
if migrations_needed:
start_args.append("--fill-cache")
if IS_SERVER_UP:
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py
index 0f6cf3cbff1..6d9ba59b787 100755
--- a/scripts/lib/zulip_tools.py
+++ b/scripts/lib/zulip_tools.py
@@ -645,6 +645,9 @@ def deport(netloc: str) -> str:
def start_arg_parser(action: str, add_help: bool = False) -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(add_help=add_help)
parser.add_argument("--fill-cache", action="store_true", help="Fill the memcached caches")
+ parser.add_argument(
+ "--skip-checks", action="store_true", help="Skip syntax and database checks"
+ )
if action == "restart":
parser.add_argument(
"--less-graceful",
diff --git a/scripts/restart-server b/scripts/restart-server
index 44ce9ea32a5..f43f7ad071b 100755
--- a/scripts/restart-server
+++ b/scripts/restart-server
@@ -41,6 +41,11 @@ if pwd.getpwuid(os.getuid()).pw_name != "zulip":
logging.error("Must be run as user 'zulip'.")
sys.exit(1)
+
+if not args.skip_checks:
+ logging.info("Running syntax and database checks")
+ subprocess.check_call(["./manage.py", "check", "--database", "default"])
+
if args.fill_cache:
logging.info("Filling memcached caches")
subprocess.check_call(["./manage.py", "fill_memcached_caches", "--skip-checks"])