mirror of https://github.com/zulip/zulip.git
restart-server: Default to running config and database checks.
If there is a syntax error in `settings.py`, `restart-server` should provide a reasonable message about this. It did so prior toaf08bcdb3f
, becausde any invocation `./manage.py` without `--skip-checks` will verify `settings.py`, among several other checks. Afteraf08bcdb3f
, there are no `./manage.py` calls in most restarts, whichfa77be6e6c
took further. Add an explicit `./manage.py check` in the default case. upgrade-zulip-stage-2 overrides this by passing `--skip-checks`, for performance. This also means that `upgrade-zulip-from-git` itself picks up the same `--skip-checks` flag, since it inherits the same flag parsing, though that is perhaps of dubious utility.
This commit is contained in:
parent
e0838ecf93
commit
f5f6a3789b
|
@ -363,7 +363,8 @@ else:
|
||||||
|
|
||||||
# Perform system checks -- including database checks, so we don't need
|
# Perform system checks -- including database checks, so we don't need
|
||||||
# to do them when we do migrations, below.
|
# 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
|
# Our next optimization is to check whether any migrations are needed
|
||||||
# before we start the critical section of the restart. This saves
|
# before we start the critical section of the restart. This saves
|
||||||
|
@ -465,7 +466,7 @@ else:
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.info("Restarting Zulip...")
|
logging.info("Restarting Zulip...")
|
||||||
start_args = []
|
start_args = ["--skip-checks"]
|
||||||
if migrations_needed:
|
if migrations_needed:
|
||||||
start_args.append("--fill-cache")
|
start_args.append("--fill-cache")
|
||||||
if IS_SERVER_UP:
|
if IS_SERVER_UP:
|
||||||
|
|
|
@ -645,6 +645,9 @@ def deport(netloc: str) -> str:
|
||||||
def start_arg_parser(action: str, add_help: bool = False) -> argparse.ArgumentParser:
|
def start_arg_parser(action: str, add_help: bool = False) -> argparse.ArgumentParser:
|
||||||
parser = argparse.ArgumentParser(add_help=add_help)
|
parser = argparse.ArgumentParser(add_help=add_help)
|
||||||
parser.add_argument("--fill-cache", action="store_true", help="Fill the memcached caches")
|
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":
|
if action == "restart":
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--less-graceful",
|
"--less-graceful",
|
||||||
|
|
|
@ -41,6 +41,11 @@ if pwd.getpwuid(os.getuid()).pw_name != "zulip":
|
||||||
logging.error("Must be run as user 'zulip'.")
|
logging.error("Must be run as user 'zulip'.")
|
||||||
sys.exit(1)
|
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:
|
if args.fill_cache:
|
||||||
logging.info("Filling memcached caches")
|
logging.info("Filling memcached caches")
|
||||||
subprocess.check_call(["./manage.py", "fill_memcached_caches", "--skip-checks"])
|
subprocess.check_call(["./manage.py", "fill_memcached_caches", "--skip-checks"])
|
||||||
|
|
Loading…
Reference in New Issue