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 ce11b84e Revert "RW hosts now same as RO hosts; drop defaults"
ce11b84e is described below
commit ce11b84ef7986ddc5fdb4700a1aadcb18eff9df3
Author: Sebb <[email protected]>
AuthorDate: Fri Aug 5 20:41:27 2022 +0100
Revert "RW hosts now same as RO hosts; drop defaults"
This reverts commit 43dcfabe8d7bfdaab4a8ef6e0303b2a830bf2212.
---
lib/whimsy/asf/ldap.rb | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index c958dfe1..d51ac41b 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -43,6 +43,19 @@ module ASF
@@weakrefs = Set.new
module LDAP
+ # see https://s.apache.org/IWu8
+ # Previously derived from the following sources:
+ # *
https://github.com/apache/infrastructure-puppet/blob/deployment/data/common.yaml
(ldapserver::slapd_peers)
+ # Updated 2018-02-24
+ RO_HOSTS = %w(
+ ldaps://ldap-us-ro.apache.org:636
+ ldaps://ldap-eu-ro.apache.org:636
+ )
+
+ RW_HOSTS = %w(
+ ldaps://ldap-master.apache.org:636
+ )
+
# Mutex preventing simultaneous connections to LDAP from a single process
CONNECT_LOCK = Mutex.new
@@ -139,20 +152,19 @@ module ASF
@host
end
- # allow override of writable host by :ldaprw
+ # allow override of RW_HOSTS by :ldaprw or :ldap config
def self.rwhosts
return @rwhosts if @rwhosts # cache the rwhosts list
- rwhosts = Array(ASF::Config.get(:ldaprw)) # allow separate override for
RW LDAP
- rwhosts = hosts if rwhosts.empty? # default to RO hosts
- raise 'Cannot determine writable LDAP URI from ldap.conf or local
config!' if rwhosts.empty?
- @rwhosts = rwhosts
+ rwhosts = Array(ASF::Config.get(:ldaprw))
+ rwhosts = Array(ASF::Config.get(:ldap)) if rwhosts.empty?
+ rwhosts = RW_HOSTS if rwhosts.empty?
+ @rwhosts = rwhosts
end
# determine what LDAP hosts are available
- # use_config=false is needed for the configure method only
def self.hosts(use_config = true)
return @hosts if @hosts # cache the hosts list
- # try whimsy config (overrides ldap.conf)
+ # try whimsy config
hosts = Array(ASF::Config.get(:ldap))
# check system configuration
@@ -167,8 +179,9 @@ module ASF
Wunderbar.debug "Using hosts from Whimsy config"
end
- # There is no default
- raise 'Cannot determine LDAP URI from ldap.conf or local config!' if
hosts.empty?
+ # if all else fails, use default list
+ Wunderbar.debug "Using default host list" if hosts.empty?
+ hosts = ASF::LDAP::RO_HOSTS if hosts.empty?
hosts.shuffle!
# Wunderbar.debug "Hosts:\n#{hosts.join(' ')}"