swift-init return codes
Currently, swift-init returns zero if can't locate config on start. Because of this problem, it is not possible to distinguish if managed to start server. Due to legacy two new complementary options are added. Default is context dependent. --strict returns non-zero if some config is missing (default mode if explicitly named server) --non-strict returns zero even if some config is missing (default mode if alias is used) As a side effect: If some of demanded servers already running it does not try to start unstarted and also returns non-zero (in strict mode). That is still sufficient for the goal of patch. For future improvements LSB status codes should be considered. DocImpact Change-Id: I7750abd4a94875b46f83f4aeee8509388d543c2b
This commit is contained in:
committed by
Peter Lisák
parent
166c34383a
commit
7b7c6c5249
@@ -50,6 +50,16 @@ def main():
|
||||
dest="run_dir", default=RUN_DIR,
|
||||
help="alternative directory to store running pid files "
|
||||
"default: %s" % RUN_DIR)
|
||||
# Changing behaviour if missing config
|
||||
parser.add_option('--strict', dest='strict', action='store_true',
|
||||
help="Return non-zero status code if some config is "
|
||||
"missing. Default mode if server is explicitly "
|
||||
"named.")
|
||||
# a negative option for strict
|
||||
parser.add_option('--non-strict', dest='strict', action='store_false',
|
||||
help="Return zero status code even if some config is "
|
||||
"missing. Default mode if server is one of aliases "
|
||||
"`all`, `main` or `rest`.")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user