upgrade-zulip-stage-2: Added argument to skip purging old deployments.

This makes it possible to add --skip-purge-old-deployments in the
deploy_options section of /etc/zulip/zulip.conf, and control whether
old deployments are purged automatically on a system.

We still need to do https://github.com/zulip/zulip/issues/10534 and
probably also to add these arguments to be directly passed into
upgrade-zulip, but that can wait for future work.

Fixes #10946.
This commit is contained in:
Sumanth V Rao 2018-12-13 19:39:27 +05:30 committed by Tim Abbott
parent 08e315e962
commit 76c6cf8c3a
1 changed files with 7 additions and 1 deletions

View File

@ -41,6 +41,8 @@ parser.add_argument("--skip-migrations", dest="skip_migrations", action='store_t
help="Skip doing migrations.") help="Skip doing migrations.")
parser.add_argument("--from-git", dest="from_git", action='store_true', parser.add_argument("--from-git", dest="from_git", action='store_true',
help="Upgrading from git, so run update-prod-static.") help="Upgrading from git, so run update-prod-static.")
parser.add_argument("--skip-purge-old-deployments", dest="skip_purge_old_deployments",
action="store_true", help="Skip purging old deployments.")
args = parser.parse_args() args = parser.parse_args()
deploy_path = args.deploy_path deploy_path = args.deploy_path
@ -178,4 +180,8 @@ logging.info("Restarting Zulip...")
subprocess.check_output(["./scripts/restart-server"], preexec_fn=su_to_zulip) subprocess.check_output(["./scripts/restart-server"], preexec_fn=su_to_zulip)
logging.info("Upgrade complete!") logging.info("Upgrade complete!")
subprocess.check_call(["./scripts/purge-old-deployments"]) if not args.skip_purge_old_deployments:
logging.info("Purging old deployments...")
subprocess.check_call(["./scripts/purge-old-deployments"])
else:
logging.info("Skipping purging old deployments.")