Fix git users synchonization for new gitlab version
@@ -545,9 +545,14 @@ class GitServer(object):
if 'id' not in key or 'title' not in key or 'key' not in key:
return None, None
if key['title'] == self.__config__.git_ssh_title:
- return key['id'], key['key']
+ return key['id'], self.get_ssh_key_value(key['key'])
return None, None
+ def get_ssh_key_value(self, key):
+ if self.__gitlab_api_version__ == 'v3':
+ return key
+ return ' '.join(key.split(' ')[:2]).strip()
+
def add_user_ssh_key(self, git_user, public_key):
print 'Creating ssh public key for user {} ({}) in git'.format(git_user.name, git_user.email)
self.__api__.add_user_ssh_key(git_user.id, self.__config__.git_ssh_title, public_key)
