Make the openshift sync script continue if one key is invalid

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2016-07-01 01:34:17 +00:00
parent bca365bbf4
commit 1b3b86c2cf

View file

@ -25,7 +25,9 @@ def add_key(host,user,passwd,key_name,key_type,key_contents, verbose=False):
print('Adding key %(keyname)s' % {'keyname': key_name})
os = Openshift(host=host,user=user,passwd=passwd)
(resp, content) = os.key_add(name=key_name, type=key_type, key_str=key_contents)
if resp != 200:
# 200 = ok, 201 = created, 422 = error in key format
# The latest one is an error, but shouldn't break adding the rest of the keys
if resp != 200 and resp != 201 and resp != 422:
print('ERROR! Result: %(resp)s' % {'resp': resp})
sys.exit(2)
if verbose: