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

[tor-commits] [ooni-probe/master] Set a default collector



commit c6d4fff1d3fcf39181311adad57cff576d5d497f
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Thu Feb 21 12:01:53 2013 +0100

    Set a default collector
---
 collector       |    1 +
 ooni/oonicli.py |    3 ++-
 ooni/runner.py  |    9 +++++++++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/collector b/collector
new file mode 100644
index 0000000..0b260a1
--- /dev/null
+++ b/collector
@@ -0,0 +1 @@
+httpo://nkvphnp3p6agi5qq.onion
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index c18f3bd..4a638e0 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -28,7 +28,8 @@ class Options(usage.Options):
                 " files listed on the command line")
 
     optFlags = [["help", "h"],
-                ["resume", "r"]]
+                ["resume", "r"],
+                ["no-default-reporter", "n"]]
 
     optParameters = [["reportfile", "o", None, "report file name"],
                      ["testdeck", "i", None,
diff --git a/ooni/runner.py b/ooni/runner.py
index 19d7e1f..a602234 100644
--- a/ooni/runner.py
+++ b/ooni/runner.py
@@ -4,6 +4,7 @@ import time
 import inspect
 import traceback
 import itertools
+import random
 
 import yaml
 
@@ -413,6 +414,14 @@ def runTestCases(test_cases, options, cmd_line_options):
 
     test_inputs = options['inputs']
 
+    # Set a default reporter
+    if not cmd_line_options['collector'] and not \
+        cmd_line_options['no-default-reporter']:
+        with open('collector') as f:
+            reporter_url = random.choice(f.readlines())
+            reporter_url = reporter_url.split('#')[0].strip()
+            cmd_line_options['collector'] = reporter_url
+
     oonib_reporter = OONIBReporter(cmd_line_options)
     yaml_reporter = YAMLReporter(cmd_line_options)
 



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