Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
restart-server: Factor out argparser, to allow reuse.
Alex Vandiverfb3368b482e5
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.pyindex 4f4c1aa90a8..f4669cc110b 100755--- a/scripts/lib/zulip_tools.py+++ b/scripts/lib/zulip_tools.py@@ -653,6 +653,23 @@ def deport(netloc: str) -> str:return "[" + r.hostname + "]" if ":" in r.hostname else r.hostname+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")+ if action == "restart":+ parser.add_argument(+ "--less-graceful",+ action="store_true",+ help="Restart with more concern for expediency than minimizing availability interruption",+ )+ parser.add_argument(+ "--skip-tornado",+ action="store_true",+ help="Do not restart Tornado processes",+ )+ return parser++if __name__ == "__main__":cmd = sys.argv[1]if cmd == "make_deploy_path":diff --git a/scripts/restart-server b/scripts/restart-serverindex 0ac13f84630..a8bb94780a6 100755--- a/scripts/restart-server+++ b/scripts/restart-server@@ -1,5 +1,4 @@#!/usr/bin/env python3-import argparseimport loggingimport osimport pwd@@ -20,6 +19,7 @@ from scripts.lib.zulip_tools import (has_process_fts_updates,list_supervisor_processes,overwrite_symlink,+ start_arg_parser,)action = "restart"@@ -30,19 +30,7 @@ verbing = action.title() + "ing"logging.Formatter.converter = time.gmtimelogging.basicConfig(format=f"%(asctime)s {action}-server: %(message)s", level=logging.INFO)-parser = argparse.ArgumentParser()-parser.add_argument("--fill-cache", action="store_true", help="Fill the memcached caches")-if action == "restart":- parser.add_argument(- "--less-graceful",- action="store_true",- help="Restart with more concern for expediency than minimizing availability interruption",- )- parser.add_argument(- "--skip-tornado",- action="store_true",- help="Do not restart Tornado processes",- )+parser = start_arg_parser(action=action, add_help=True)args = parser.parse_args()deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))