[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [fallback-scripts/master] script: Make check_existing mode configurable with env vars



commit 6df41923505506c54ff7e08cd09932bd86396d6f
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Thu Jun 27 14:47:35 2019 +1000

    script: Make check_existing mode configurable with env vars
    
    Tested with:
    $ TOR_FB_MAX_FALLBACK_COUNT=10 ./updateFallbackDirs.py check_existing
    $ TOR_FB_MODE=check_existing TOR_FB_MAX_FALLBACK_COUNT=10 ./updateFallbackDirs.py
    
    Part of 29100.
---
 updateFallbackDirs.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/updateFallbackDirs.py b/updateFallbackDirs.py
index 229967f..23991ad 100755
--- a/updateFallbackDirs.py
+++ b/updateFallbackDirs.py
@@ -3,11 +3,10 @@
 # Usage:
 #
 # Regenerate the list:
-# $ TOR_FB_MODE=""
 # $ TOR_FB_DATE=`date -u "+%Y-%m-%d-%H-%M-%S"`
 # $ TOR_FB_COUNTRY=ZZ
 # $ TOR_FB_COMMIT=`git rev-parse --short=16 HEAD`
-# $ ./updateFallbackDirs.py $TOR_FB_MODE \
+# $ ./updateFallbackDirs.py \
 #     > fallback_dirs_"$TOR_FB_DATE"_"$TOR_FB_COUNTRY"_"$TOR_FB_COMMIT".inc \
 #     2> fallback_dirs_"$TOR_FB_DATE"_"$TOR_FB_COUNTRY"_"$TOR_FB_COMMIT".log
 # $ cp fallback_dirs_*.inc ../tor/src/app/config/fallback_dirs.inc
@@ -105,6 +104,13 @@ FALLBACK_FORMAT_VERSION = '2.0.0'
 SECTION_SEPARATOR_BASE = '====='
 SECTION_SEPARATOR_COMMENT = '/* ' + SECTION_SEPARATOR_BASE + ' */'
 
+## Mode Settings
+
+# Use "check_existing" to check existing fallbacks, or anything else to create
+# a new list. Overridden by the command-line argument "check_existing".
+MODE = getenv_conf('TOR_FB_MODE',
+                   '', str)
+
 # Output all candidate fallbacks, or only output selected fallbacks?
 OUTPUT_CANDIDATES = getenv_conf('TOR_FB_OUTPUT_CANDIDATES',
                                 False, bool)
@@ -2324,7 +2330,7 @@ def get_command():
   if len(sys.argv) == 2:
     return sys.argv[1]
   else:
-    return None
+    return MODE
 
 def log_excluded(msg, *args):
   if get_command() == 'check_existing':



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits