From 47a2ab9cfccc255ccb0e96c3fedbf29f13c884f6 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Wed, 22 Jul 2015 10:52:37 +0300 Subject: [PATCH] Return non-zero exit code if the command cannot be completed successfully. Fixes #5084 --- mediagoblin/gmg_commands/users.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py index ad22c169..33abc891 100644 --- a/mediagoblin/gmg_commands/users.py +++ b/mediagoblin/gmg_commands/users.py @@ -16,6 +16,8 @@ from __future__ import print_function +import sys + import six from mediagoblin.gmg_commands import util as commands_util @@ -50,6 +52,7 @@ def adduser(args): if users_with_username: print(u'Sorry, a user with that name already exists.') + sys.exit(1) else: # Create the user @@ -95,6 +98,7 @@ def makeadmin(args): print(u'The user is now Admin') else: print(u'The user doesn\'t exist') + sys.exit(1) def changepw_parser_setup(subparser): @@ -119,6 +123,7 @@ def changepw(args): print(u'Password successfully changed') else: print(u'The user doesn\'t exist') + sys.exit(1) def deleteuser_parser_setup(subparser): @@ -139,3 +144,4 @@ def deleteuser(args): print('The user %s has been deleted' % args.username) else: print('The user %s doesn\'t exist' % args.username) + sys.exit(1) -- 2.25.1