[sysadmin-bin] Fail gracefully in case an l10n_group member is there already or cannot be removed
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Fail gracefully in case an l10n_group member is there already or cannot be removed
- Date: Thu, 20 May 2021 12:20:58 +0000 (UTC)
commit b2fab7362bc474a6677eb0a849c3d8c1738f748d
Author: Andrea Veri <averi redhat com>
Date: Thu May 20 14:20:40 2021 +0200
Fail gracefully in case an l10n_group member is there already or cannot be removed
gitlab/gitlab-operations.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index eb7e298..f765b8c 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -51,8 +51,12 @@ for username, id in _committers.items():
gnome_group.members.create({'user_id': id, 'access_level': gitlab.DEVELOPER_ACCESS})
print(f"Account with username { username } and with id { id } has been added to the GNOME group")
- l10n_group.members.create({'user_id': id, 'access_level': gitlab.REPORTER_ACCESS})
- print(f"Account with username { username } and id { id } has been added to the Teams/Translation
group")
+ try:
+ l10n_group.members.create({'user_id': id, 'access_level': gitlab.REPORTER_ACCESS})
+ print(f"Account with username { username } and id { id } has been added to the Teams/Translation
group")
+ except gitlab.exceptions.GitlabCreateError as e:
+ if e.response_code == 409:
+ pass
for username, id in gnome_group_users.items():
if id not in _committers.values() and id not in _committers_exceptions.values():
@@ -61,8 +65,12 @@ for username, id in gnome_group_users.items():
gnome_group.members.delete(id)
print(f"Account with username { username } with id { id } has been removed from the GNOME group")
+ try:
l10n_group.members.delete(id)
print(f"Account with username { username } and id { id } has been removed from the
Teams/Translation group")
+ except gitlab.exceptions.GitlabDeleteError as e:
+ if e.response_code == 404:
+ pass
maints = dict()
for project in gnome_projects:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]