[sysadmin-bin] Ignore usernames starting with project_$project_id_bot* (These usernames are reserved on the GitLab



commit 066a91054b0329cf89e7deb53fce5a481fe27238
Author: Andrea Veri <averi redhat com>
Date:   Tue Oct 19 19:19:36 2021 +0200

    Ignore usernames starting with project_$project_id_bot* (These usernames are reserved on the GitLab side 
for automation purposes)

 gitlab/gitlab-operations.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index 644ea43..f66af07 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -175,9 +175,10 @@ for project in maints:
         if member not in maints[project]:
             _member = proj.members.get(members_dict[member])
             if _member.attributes['access_level'] == 40:
-                proj.members.delete(members_dict[member])
+                if not _member.attributes['username'].startswith(f"project_{ proj.attributes['id'] }_bot"):
+                    proj.members.delete(members_dict[member])
 
-                print(f"Dropped master level access to { member } against repository { project } as 
maintainer entry is missing on the DOAP file")
+                    print(f"Dropped master level access to { member } against repository { project } as 
maintainer entry is missing on the DOAP file")
             elif _member.attributes['access_level'] == 20:
                 pass
             else:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]