[sysadmin-bin] We also need to take account cases where the user is not yet part of the project as a member
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] We also need to take account cases where the user is not yet part of the project as a member
- Date: Mon, 7 Jun 2021 15:44:14 +0000 (UTC)
commit 431ff04c51534aa9bc6aae44b013713b1129f49b
Author: Andrea Veri <averi redhat com>
Date: Mon Jun 7 17:37:52 2021 +0200
We also need to take account cases where the user is not yet part of the project as a member
gitlab/gitlab-operations.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index f765b8c..ddd87c1 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -138,11 +138,18 @@ for project in maints:
for user in maints[project]:
if user in _committers.keys():
userid = _committers[user]
- if proj.members.get(userid).access_level != 40:
- member = proj.members.get(userid)
+
+ try:
proj.members.create({'user_id': userid, 'access_level': gitlab.MASTER_ACCESS})
print(f"Landed master level access to { user } against repository { project }")
+ except gitlab.exceptions.GitlabCreateError as e:
+ if e.response_code == 409:
+ if proj.members.get(userid).access_level != 40:
+ proj.members.delete(userid)
+ proj.members.create({'user_id': userid, 'access_level': gitlab.MASTER_ACCESS})
+
+ print(f"Landed master level access to { user } against repository { project }")
members = proj.members.list()
members_dict = {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]