You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/01/30 19:44:36 UTC

[whimsy] branch master updated: Emulate original ldap_committee output from projects and CI

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 40bd8cf  Emulate original ldap_committee output from projects and CI
40bd8cf is described below

commit 40bd8cfc9f39611cf073c0cc6a23b20667818552
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jan 30 19:44:35 2019 +0000

    Emulate original ldap_committee output from projects and CI
---
 www/roster/public_ldap_committees.rb | 60 ++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 33 deletions(-)

diff --git a/www/roster/public_ldap_committees.rb b/www/roster/public_ldap_committees.rb
index 587f7f1..feefabf 100644
--- a/www/roster/public_ldap_committees.rb
+++ b/www/roster/public_ldap_committees.rb
@@ -1,5 +1,10 @@
-# Reads LDAP ou=pmc,ou=committees,ou=groups,dc=apache,dc=org
-# Also reads ou=projects
+# Reads LDAP ou=projects and committee-info
+#
+# Previously read LDAP ou=pmc,ou=committees,ou=groups,dc=apache,dc=org
+# but this is deprecated.
+# The output is intended to include the same entries as before;
+# as such it includes tac and security even though they are not PMCs
+#
 # Creates JSON output with the following format:
 #
 # {
@@ -21,45 +26,34 @@ require_relative 'public_json_common'
 # gather committee info
 entries = {}
 
-committees = ASF::Committee.preload # for performance
 projects = ASF::Project.preload
+# which projects should be in the committees file?
+# The output previously included all entries in the LDAP committee group,
+# i.e. tac and security as well as all valid PMCs
+# TODO perhaps drop these?
+pmcs = ASF::Committee.pmcs.map(&:name) + ['tac', 'security']
 
-if committees.empty?
+if projects.empty?
   Wunderbar.error "No results retrieved, output not created"
   exit 0
 end
 
 lastStamp = ''
 
-# Hack: ensure all names are represented in the hash
-ASF::Committee::GUINEAPIGS.each do |pig|
-  unless ASF::Committee.find(pig).modifyTimestamp # hack detect missing entry
-    committees[ASF::Committee.new(pig)] = [] # add a dummy entry
-  end 
-end
-
-committees.keys.sort_by {|a| a.name}.each do |entry|
-    m = []
-    if ASF::Committee::isGuineaPig? entry.name
-        project = ASF::Project.find(entry.name)
-        createTimestamp = project.createTimestamp
-        modifyTimestamp = project.modifyTimestamp
-        project.owners.sort_by {|a| a.name}.each do |e|
-            m << e.name
-        end
-    else
-        createTimestamp = entry.createTimestamp
-        modifyTimestamp = entry.modifyTimestamp
-        entry.members.sort_by {|a| a.name}.each do |e|
-            m << e.name
-        end
-    end
-    lastStamp = modifyTimestamp if modifyTimestamp > lastStamp
-    entries[entry.name] = {
-        createTimestamp: createTimestamp,
-        modifyTimestamp: modifyTimestamp,
-        roster: m 
-    }
+projects.keys.sort_by {|a| a.name}.each do |project|
+  next unless pmcs.include? project.name
+  m = []
+  createTimestamp = project.createTimestamp
+  modifyTimestamp = project.modifyTimestamp
+  project.owners.sort_by {|a| a.name}.each do |e|
+      m << e.name
+  end
+  lastStamp = modifyTimestamp if modifyTimestamp > lastStamp
+  entries[project.name] = {
+      createTimestamp: createTimestamp,
+      modifyTimestamp: modifyTimestamp,
+      roster: m
+  }
 end
 
 info = {