From 1b3b86c2cf3a2c58a6860f3185f2de9893c7cdf4 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Fri, 1 Jul 2016 01:34:17 +0000 Subject: [PATCH] Make the openshift sync script continue if one key is invalid Signed-off-by: Patrick Uiterwijk --- roles/batcave/files/sync-openshift-keys.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/batcave/files/sync-openshift-keys.py b/roles/batcave/files/sync-openshift-keys.py index 47c0141dcc..007be415ea 100755 --- a/roles/batcave/files/sync-openshift-keys.py +++ b/roles/batcave/files/sync-openshift-keys.py @@ -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: