From 9c76675bf8eb7802c680e450e5cef0283486d568 Mon Sep 17 00:00:00 2001 From: Sebb Date: Fri, 13 Sep 2024 10:27:43 +0100 Subject: [PATCH] Some files now in Puppet --- lib/spec/lib/svn_spec.rb | 2 +- lib/spec/spec_helper.rb | 5 +++-- .../apmail_bin/mail_list_autosub.yml | 0 lib/whimsy/asf/auth.rb | 3 ++- lib/whimsy/asf/config.rb | 2 ++ lib/whimsy/asf/icla.rb | 2 +- lib/whimsy/asf/mail.rb | 2 +- repository.yml | 14 -------------- 8 files changed, 10 insertions(+), 20 deletions(-) rename lib/test/{svn => puppet-data}/apmail_bin/mail_list_autosub.yml (100%) diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb index f3d6658c87..1e60761470 100644 --- a/lib/spec/lib/svn_spec.rb +++ b/lib/spec/lib/svn_spec.rb @@ -132,7 +132,7 @@ it 'should return an array of size 2' do res = ASF::SVN.private_public expect(res.size()).to eq(2) - expect(res[0].size).to eq(15) # will need to be adjusted from time to time + expect(res[0].size).to eq(13) # will need to be adjusted from time to time expect(res[1].size).to eq(6) # ditto. end end diff --git a/lib/spec/spec_helper.rb b/lib/spec/spec_helper.rb index 5201c359c3..d8b1b9c7c7 100644 --- a/lib/spec/spec_helper.rb +++ b/lib/spec/spec_helper.rb @@ -17,6 +17,7 @@ lib = File.expand_path('..', __dir__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib +require 'wunderbar' # may be needed by svn require 'whimsy/asf/config' # must be loaded before updating config require 'whimsy/asf/svn' # must be loaded before updating config # Don't load 'whimsy/asf' here as some classes may depend on overrides below @@ -25,10 +26,10 @@ SAMPLE_SVN_URL_RE = %r{https://.+/minutes} # Override with test data if there is no checkout available (allows local use) -if ENV['RAKE_TEST'] == 'TRUE' or not (ASF::SVN.find('apmail_bin') and ASF::SVN.find('board')) +if ENV['RAKE_TEST'] == 'TRUE' or not (File.exist?(File.join(ASF::Config[:puppet_data], 'apmail_bin')) and ASF::SVN.find('board')) TEST_DATA = true # Test data is smaller so some tests need adjusting puts 'Overriding data directories' - ASF::SVN['apmail_bin'] = File.expand_path('../test/svn/apmail_bin', __dir__) + ASF::Config[:puppet_data] = File.expand_path('../test/puppet-data', __dir__) ASF::SVN['board'] = File.expand_path('../test/svn/board', __dir__) ASF::SVN[SAMPLE_SVN_NAME] = File.expand_path('../test/svn/minutes', __dir__) ASF::Config[:subscriptions] = File.expand_path('../test/subscriptions', __dir__) diff --git a/lib/test/svn/apmail_bin/mail_list_autosub.yml b/lib/test/puppet-data/apmail_bin/mail_list_autosub.yml similarity index 100% rename from lib/test/svn/apmail_bin/mail_list_autosub.yml rename to lib/test/puppet-data/apmail_bin/mail_list_autosub.yml diff --git a/lib/whimsy/asf/auth.rb b/lib/whimsy/asf/auth.rb index 1c3666d087..a88675d845 100644 --- a/lib/whimsy/asf/auth.rb +++ b/lib/whimsy/asf/auth.rb @@ -6,7 +6,8 @@ class Authorization include Enumerable # N.B. This data is maintained by a cron job on the Whimsy server, which has access - PUPPET_PATH = '/srv/puppet-data/authorization' # Puppet auth data is stored here + PUPPET_DATA = ASF::Config[:puppet_data] + PUPPET_PATH = File.join(PUPPET_DATA, 'authorization') # Puppet auth data is stored here # Return the set of authorizations a given user (availid) has access to. def self.find_by_id(value) diff --git a/lib/whimsy/asf/config.rb b/lib/whimsy/asf/config.rb index 9f24ce15fc..a4793d138d 100644 --- a/lib/whimsy/asf/config.rb +++ b/lib/whimsy/asf/config.rb @@ -67,6 +67,8 @@ class Config # default location of LDAP credentials @config[:ldap_creds] ||= '/srv/ldap.txt' + # default location of Puppet data + @config[:puppet_data] ||= '/srv/puppet-data' # The cache is used for local copies of SVN files that may be updated by Whimsy # for example: podlings.xml diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb index 2cc52aa9ef..fa590d822e 100644 --- a/lib/whimsy/asf/icla.rb +++ b/lib/whimsy/asf/icla.rb @@ -239,7 +239,7 @@ def self.sort(source) # list of mails rejected by badrcptto and badrcptto_patterns # Not intended for external use def self.badmails - qmc = ASF::SVN['qmail_control'] + qmc = File.join(ASF::Config[:puppet_data], 'qmail_control') # non-patterns brt = File.join(qmc, 'badrcptto') badmails = File.read(brt).scan(/^(\w.+)@apache\.org\s*$/).flatten diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb index 7bb52f9b39..58091db084 100644 --- a/lib/whimsy/asf/mail.rb +++ b/lib/whimsy/asf/mail.rb @@ -243,7 +243,7 @@ def self.to_canonical(email) # Load the auto-subscription file def self._load_auto - apmail_bin = ASF::SVN['apmail_bin'] + apmail_bin = File.join(ASF::Config[:puppet_data], 'apmail_bin') # Loaded by puppet auto_file = File.join(apmail_bin, 'mail_list_autosub.yml') auto_mtime = File.mtime(auto_file) # fetch this up front in case file updated during loading if not @auto or auto_mtime != @auto_mtime diff --git a/repository.yml b/repository.yml index a4af40124a..05f492c625 100644 --- a/repository.yml +++ b/repository.yml @@ -33,12 +33,6 @@ files: - apacheconhistory.csv - apmail_bin: - url: infra/infrastructure/apmail/trunk/bin - depth: empty - files: - - mail_list_autosub.yml - attic-xdocs: url: asf/attic/site/xdocs/projects depth: delete @@ -166,14 +160,6 @@ url: private/foundation/officers/personnel-duties depth: files -# for access to badrcptto files: - qmail_control: - url: infra/infrastructure/trunk/qmail/control - depth: empty - files: - - badrcptto - - badrcptto_patterns - # for Treasurer access to financial records records: url: asf/infrastructure/site/trunk/content/foundation/records