[sysadmin-bin] provider ldapmain is not always the first element of the index
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] provider ldapmain is not always the first element of the index
- Date: Mon, 16 Oct 2017 16:29:36 +0000 (UTC)
commit 229e542a4cbe9afa1c3200a809c6cc648fee1223
Author: Andrea Veri <averi redhat com>
Date: Mon Oct 16 18:29:27 2017 +0200
provider ldapmain is not always the first element of the index
gitlab/gitlab.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gitlab/gitlab.py b/gitlab/gitlab.py
index 94c78f9..eccdcc8 100755
--- a/gitlab/gitlab.py
+++ b/gitlab/gitlab.py
@@ -37,11 +37,9 @@ class Gitlab:
next_url = the_page.split(';')[1].split(',')[1].replace('<','').replace('>','').replace(' ', '')
for user in data:
- try:
- if user['identities'][0]['provider'] == 'ldapmain':
- users[user['id']] = user['identities'][0]['extern_uid'].split(',')[0].replace('uid=', '')
- except IndexError:
- continue
+ for index, _ in enumerate(user['identities']):
+ if user['identities'][index]['provider'] == 'ldapmain':
+ users[user['id']] =
user['identities'][index]['extern_uid'].split(',')[0].replace('uid=', '')
if is_last == 'next':
url = next_url
@@ -86,6 +84,8 @@ class Gitlab:
if user['username'] == 'root':
pass
else:
- members.append(user['identities'][0]['extern_uid'].split(',')[0].replace('uid=', ''))
+ for index, _ in enumerate(user['identities']):
+ if user['identities'][index]['provider'] == 'ldapmain':
+
members.append(user['identities'][index]['extern_uid'].split(',')[0].replace('uid=', ''))
return members
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]