Provide an exit code when raising SystemExit.

This will make it easier for scripts which call OpenStack tools to
detect failure if SystemExit isn't caught by the calling code.

Change-Id: Ic829b704d1629fcb0d926118367af122c25b7fba
This commit is contained in:
Michael Still 2024-07-24 19:49:18 +10:00
parent bc7cc773d1
commit 033eb03b52
3 changed files with 3 additions and 3 deletions

View File

@ -2990,7 +2990,7 @@ class ConfigOpts(abc.Mapping):
except ValueError:
sys.stderr.write("argument --%s: Invalid %s value: %s\n" % (
opt.dest, repr(opt.type), value))
raise SystemExit
raise SystemExit(1)
def _reload_config_files(self):
namespace = self._parse_config_files()

View File

@ -826,7 +826,7 @@ def main(args=None):
except cfg.RequiredOptError:
conf.print_help()
if not sys.argv[1:]:
raise SystemExit
raise SystemExit(1)
raise
generate(conf)

View File

@ -227,7 +227,7 @@ def main():
except cfg.RequiredOptError:
conf.print_help()
if not sys.argv[1:]:
raise SystemExit
raise SystemExit(1)
raise
return _validate(conf)