@@ -32,6 +32,7 @@ from scripts.lib.zulip_tools import (
32
32
get_config_file ,
33
33
parse_os_release ,
34
34
run_psql_as_postgres ,
35
+ start_arg_parser ,
35
36
su_to_zulip ,
36
37
)
37
38
@@ -72,7 +73,9 @@ if (vendor, os_version) in UNSUPPORTED_DISTROS:
72
73
# make sure we have appropriate file permissions
73
74
os .umask (0o22 )
74
75
75
- parser = argparse .ArgumentParser ()
76
+ restart_parser = start_arg_parser (action = "restart" , add_help = False )
77
+
78
+ parser = argparse .ArgumentParser (parents = [restart_parser ])
76
79
parser .add_argument ("deploy_path" , metavar = "deploy_path" , help = "Path to deployment directory" )
77
80
parser .add_argument ("--skip-puppet" , action = "store_true" , help = "Skip doing puppet/apt upgrades." )
78
81
parser .add_argument ("--skip-migrations" , action = "store_true" , help = "Skip doing migrations." )
@@ -92,6 +95,15 @@ parser.add_argument(
92
95
)
93
96
args = parser .parse_args ()
94
97
98
+ if not args .skip_puppet and args .less_graceful :
99
+ logging .warning ("Ignored --less-graceful; all upgrades without --skip-puppet are ungraceful." )
100
+
101
+ if not args .skip_puppet and args .skip_tornado :
102
+ logging .error (
103
+ "Cannot skip tornado restart unless we are skipping puppet! Omit --skip-tornado, or add --skip-puppet."
104
+ )
105
+ sys .exit (1 )
106
+
95
107
deploy_path = args .deploy_path
96
108
os .chdir (deploy_path )
97
109
@@ -312,7 +324,12 @@ if IS_SERVER_UP or not args.skip_puppet:
312
324
# Even if the server wasn't up previously, puppet might have
313
325
# started it if there were supervisord configuration changes, so
314
326
# we need to use restart-server if puppet ran.
315
- subprocess .check_output (["./scripts/restart-server" , "--fill-cache" ], preexec_fn = su_to_zulip )
327
+ restart_args = ["--fill-cache" ]
328
+ if args .skip_tornado :
329
+ restart_args .append ("--skip-tornado" )
330
+ if args .less_graceful :
331
+ restart_args .append ("--less-graceful" )
332
+ subprocess .check_output (["./scripts/restart-server" , * restart_args ], preexec_fn = su_to_zulip )
316
333
else :
317
334
subprocess .check_output (["./scripts/start-server" , "--fill-cache" ], preexec_fn = su_to_zulip )
318
335
0 commit comments