From 978cd4c2ca44858c3b1a89891a141c77a7cdd4ef Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Nov 10 2015 03:18:10 +0000 Subject: fix(koji-group-sync): Catch the exception that happens if bad username/password is given to the AccountSystem object --- diff --git a/scripts/koji-group-sync.py b/scripts/koji-group-sync.py index 2c98ccd..5901d96 100755 --- a/scripts/koji-group-sync.py +++ b/scripts/koji-group-sync.py @@ -3,6 +3,7 @@ import ConfigParser import sys from centos import AccountSystem +from centos.client import AuthError def group_users(account_system_handle): @@ -38,11 +39,15 @@ if __name__ == '__main__': GROUP_FILE = config.get('fas', 'group_file') except ConfigParser.NoOptionError as e: print >> sys.stderr, e.msg - sys.exit(-1) + sys.exit(1) - fas = AccountSystem(base_url=FAS_TOPURL, - username=FAS_USERNAME, - password=FAS_PASSWORD, - insecure=IGNORE_CERT_VALIDATION) + try: + fas = AccountSystem(base_url=FAS_TOPURL, + username=FAS_USERNAME, + password=FAS_PASSWORD, + insecure=IGNORE_CERT_VALIDATION) + except AuthError as e: + print >> sys.stderr, e.msg + sys.exit(1) write_file(group_users(fas), GROUP_FILE)