fasjson: do not make the fasjson-aliases silently catch all the exception

This just makes it much harder to debug anything as it silently crashes.
With this, it will crash, show a stacktrace and still have a return code
different from 0.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2021-04-21 18:06:10 +02:00
parent a83685e80a
commit 7e4543be97

View file

@ -115,20 +115,18 @@ def main():
# Use the system's keytab for authentication
os.environ["KRB5_CLIENT_KTNAME"] = "/etc/krb5.keytab"
try:
if not args:
gen_all_aliases()
# call newaliases script so postfix gets updated
subprocess.check_call(['/usr/bin/newaliases'])
elif len(args) == 2 and args[0] == "update":
update_user(args[1])
# call newaliases script so postfix gets updated
subprocess.check_call(['/usr/bin/newaliases'])
else:
print(f"Usage: {sys.argv[0]} [update <username>]", file=sys.stderr)
raise RuntimeError()
except Exception:
sys.exit(1)
if not args:
gen_all_aliases()
# call newaliases script so postfix gets updated
subprocess.check_call(['/usr/bin/newaliases'])
elif len(args) == 2 and args[0] == "update":
update_user(args[1])
# call newaliases script so postfix gets updated
subprocess.check_call(['/usr/bin/newaliases'])
else:
print(f"Usage: {sys.argv[0]} [update <username>]", file=sys.stderr)
exit(1)
if __name__ == "__main__":
main()