upgrade: Mark puppet as having started the server.

We previously used restart-server if puppet was run, as a nod to the
fact that `supervisor reread && supervisor update` will _start_
service groups that were modified, even if they were previously
stopped; this is because they are marked as `autostart=true`, which is
honored on service change.

However, upgrades want to run while there are no services running.  If
puppet is run, explicitly set the server as potentially being "up", so
that a `shutdown_server()` before migrations, if they exist, will stop
services.
This commit is contained in:
Alex Vandiver 2022-03-31 16:11:25 -07:00 committed by Tim Abbott
parent e9596637e7
commit 0af00a3233
1 changed files with 4 additions and 4 deletions

View File

@ -363,6 +363,9 @@ if not args.skip_puppet:
logging.info("Applying Puppet changes...")
subprocess.check_call(["./scripts/zulip-puppet-apply", "--force"])
subprocess.check_call(["apt-get", "-y", "--allow-downgrades", "upgrade"])
# Puppet may have reloaded supervisor, and in so doing started
# services; mark as potentially needing to stop the server.
IS_SERVER_UP = True
if migrations_needed:
# Database migrations assume that they run on a database in
@ -372,10 +375,7 @@ if migrations_needed:
subprocess.check_call(["./manage.py", "migrate", "--noinput"], preexec_fn=su_to_zulip)
logging.info("Restarting Zulip...")
if IS_SERVER_UP or not args.skip_puppet:
# Even if the server wasn't up previously, puppet might have
# started it if there were supervisord configuration changes, so
# we need to use restart-server if puppet ran.
if IS_SERVER_UP:
restart_args = ["--fill-cache"]
if args.skip_tornado:
restart_args.append("--skip-tornado")