From a5e2669b2fe980843468854f927e669dc84a9115 Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Fri, 8 Feb 2008 19:02:10 +0000 Subject: [PATCH] Properly handle the case when keys exists and the new key does not handle the user's existing key --- qaapi/qa/tests/sync_person_key.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qaapi/qa/tests/sync_person_key.py b/qaapi/qa/tests/sync_person_key.py index d836964..2276bb8 100755 --- a/qaapi/qa/tests/sync_person_key.py +++ b/qaapi/qa/tests/sync_person_key.py @@ -46,11 +46,10 @@ class sync_person_key(Test): public_key_file = open(public_key_path, 'r') public_key = public_key_file.readline() + key_fields = {'key_type': 'ssh', 'key': public_key} keys = api.GetKeys(auth, person['key_ids']) if not keys: # Add current key to db - key_fields = {'key_type': 'ssh', - 'key': public_key} api.AddPersonKey(auth, person['person_id'], key_fields) if self.config.verbose: utils.header("Added public key in %(public_key_path)s to db" % locals() ) @@ -58,7 +57,7 @@ class sync_person_key(Test): # keys need to be checked and possibly updated key = keys[0] if key['key'] != public_key: - api.UpdateKey(auth, key['key_id'], public_key) + api.UpdateKey(auth, key['key_id'], key_fields) if self.config.verbose: utils.header("Updated plc with new public key in %(public_key_path)s " % locals()) else: -- 2.43.0