mirror of https://github.com/zulip/zulip.git
upgrade: Move the shutdown_server calls to where they are relevant.
shutdown_server is a noop if the server is already stopped; placing these in each block makes the logic more apparent.
This commit is contained in:
parent
2df4ace441
commit
e9596637e7
|
@ -309,11 +309,10 @@ if not args.skip_migrations:
|
||||||
if line_str.startswith("[ ]"):
|
if line_str.startswith("[ ]"):
|
||||||
migrations_needed = True
|
migrations_needed = True
|
||||||
|
|
||||||
if (not args.skip_puppet or migrations_needed) and IS_SERVER_UP:
|
# NOTE: Here begins the most likely critical period, where we may be
|
||||||
# By default, we shut down the service to apply migrations and
|
# shutting down the server; we should strive to minimize the number of
|
||||||
# Puppet changes, to minimize risk of issues due to inconsistent
|
# steps that happen between here and the "Restarting Zulip" line
|
||||||
# state.
|
# below.
|
||||||
shutdown_server()
|
|
||||||
|
|
||||||
if rabbitmq_dist_listen:
|
if rabbitmq_dist_listen:
|
||||||
shutdown_server()
|
shutdown_server()
|
||||||
|
@ -327,6 +326,7 @@ if cookie_size is not None and cookie_size == 20:
|
||||||
# characters long by a good randomizer, it would be 96 bits and
|
# characters long by a good randomizer, it would be 96 bits and
|
||||||
# more than sufficient. We generate, using good randomness, a
|
# more than sufficient. We generate, using good randomness, a
|
||||||
# 255-character cookie, the max allowed length.
|
# 255-character cookie, the max allowed length.
|
||||||
|
shutdown_server()
|
||||||
logging.info("Generating a secure erlang cookie...")
|
logging.info("Generating a secure erlang cookie...")
|
||||||
subprocess.check_call(["./scripts/setup/generate-rabbitmq-cookie"])
|
subprocess.check_call(["./scripts/setup/generate-rabbitmq-cookie"])
|
||||||
|
|
||||||
|
@ -357,11 +357,17 @@ if classes != new_classes:
|
||||||
|
|
||||||
|
|
||||||
if not args.skip_puppet:
|
if not args.skip_puppet:
|
||||||
|
# Puppet may adjust random services; to minimize risk of issues
|
||||||
|
# due to inconsistent state, we shut down the server first.
|
||||||
|
shutdown_server()
|
||||||
logging.info("Applying Puppet changes...")
|
logging.info("Applying Puppet changes...")
|
||||||
subprocess.check_call(["./scripts/zulip-puppet-apply", "--force"])
|
subprocess.check_call(["./scripts/zulip-puppet-apply", "--force"])
|
||||||
subprocess.check_call(["apt-get", "-y", "--allow-downgrades", "upgrade"])
|
subprocess.check_call(["apt-get", "-y", "--allow-downgrades", "upgrade"])
|
||||||
|
|
||||||
if migrations_needed:
|
if migrations_needed:
|
||||||
|
# Database migrations assume that they run on a database in
|
||||||
|
# quiesced state.
|
||||||
|
shutdown_server()
|
||||||
logging.info("Applying database migrations...")
|
logging.info("Applying database migrations...")
|
||||||
subprocess.check_call(["./manage.py", "migrate", "--noinput"], preexec_fn=su_to_zulip)
|
subprocess.check_call(["./manage.py", "migrate", "--noinput"], preexec_fn=su_to_zulip)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue