This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch Temp
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/Temp by this push:
     new b6eff22b Allow for removal of committers role group
b6eff22b is described below

commit b6eff22b62b84886f7cf54e255386d5cd3e8998d
Author: Sebb <s...@apache.org>
AuthorDate: Sat May 31 23:08:23 2025 +0100

    Allow for removal of committers role group
    
    GHA did not like class variable reference to ASF.search_one
---
 lib/whimsy/asf/ldap.rb | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 259b1e2c..6d16e1d5 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -594,8 +594,11 @@ module ASF
   # of people, but from the list of committers.
   class Committer < Base
     @role_base = 'ou=role,ou=groups,dc=apache,dc=org' # Keep for now
+
     # Does the role group still exist?
-    @has_role_group = ASF.search_one(@role_base, 'cn=committers', 'dn').size > 0
+    def has_role_group
+      ASF.search_one(@role_base, 'cn=committers', 'dn').size > 0
+    end
 
     # get a list of committers
     def self.list
@@ -669,7 +672,7 @@ module ASF
       ASF::Group['committers'].remove(person) rescue nil
 
       # remove person from deprecated committers list, ignoring exceptions
-      if @has_role_group
+      if has_role_group
         ASF::LDAP.modify("cn=committers,#{@role_base}",
           [ASF::Base.mod_delete('member', [person.dn])]) rescue nil
       end
@@ -690,7 +693,7 @@ module ASF
       ASF::Group['committers'].add(person)
 
       # add person to deprecated committers list
-      if @has_role_group
+      if has_role_group
         ASF::LDAP.modify("cn=committers,#{@role_base}",
           [ASF::Base.mod_add('member', [person.dn])])
       end
@@ -708,7 +711,7 @@ module ASF
       ASF::Group['committers'].remove(person)
 
       # remove person from deprecated committers list
-      if @has_role_group
+      if has_role_group
         ASF::LDAP.modify("cn=committers,#{@role_base}",
           [ASF::Base.mod_delete('member', [person.dn])])
       end
@@ -1589,5 +1592,4 @@ if __FILE__ == $0
   newids = ASF.committerids()
   puts newids.length
   puts newids.first
-  ASF::RoleGroup.listcns.map {|g| puts ASF::RoleGroup.find(g).dn}
 end

Reply via email to