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 2017/08/12 15:39:50 UTC

[whimsy] branch master updated: Move one-time config fetch to constructor

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 0f0bafa  Move one-time config fetch to constructor
0f0bafa is described below

commit 0f0bafaf2fa4295b50cc4e499d7991303ea47ba5
Author: Sebb <se...@apache.org>
AuthorDate: Sat Aug 12 16:39:48 2017 +0100

    Move one-time config fetch to constructor
---
 lib/whimsy/asf/auth.rb | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/whimsy/asf/auth.rb b/lib/whimsy/asf/auth.rb
index 5ca13ae..d96fe65 100644
--- a/lib/whimsy/asf/auth.rb
+++ b/lib/whimsy/asf/auth.rb
@@ -13,6 +13,16 @@ module ASF
     # Select a given <tt>-authorization-template</tt>, valid values are
     # <tt>asf</tt> and <tt>pit</tt>.
     def initialize(file='asf')
+      # TODO - should this read the Git repo directly?
+      # Probably not: this file is read frequently so would need to be cached anyway
+      # The Git clone is updated every 10 minutes which should be sufficiently recent
+      auth = ASF::Git.find('infrastructure-puppet')
+      if auth
+        @auth = auth + '/modules/subversion_server/files/authorization'
+      else
+        # SVN copy is no longer in use - see INFRA-11452
+        raise Exception.new("Cannot find Git: infrastructure-puppet")
+      end
       @file = file
     end
 
@@ -44,17 +54,7 @@ module ASF
     private
 
     def read_auth
-      # TODO - should this read the Git repo directly?
-      # Probably not: this file is read frequently so would need to be cached anyway
-      # The Git clone is updated every 10 minutes which should be sufficiently recent
-      auth = ASF::Git.find('infrastructure-puppet')
-      if auth
-        auth += '/modules/subversion_server/files/authorization'
-      else
-        # SVN copy is no longer in use - see INFRA-11452
-        raise Exception.new("Cannot find Git: infrastructure-puppet")
-      end
-      File.read("#{auth}/#{@file}-authorization-template")
+      File.read("#{@auth}/#{@file}-authorization-template")
     end
   end
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].