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

[tor-commits] [ooni-probe/master] Add info flag to list paths for the current ooniprobe installation



commit 7f317fbadccee8566b3c2fd3c8b3ba2bb5fa3b00
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Thu Oct 27 23:04:03 2016 +0200

    Add info flag to list paths for the current ooniprobe installation
---
 ooni/scripts/ooniprobe.py |  5 +++++
 ooni/settings.py          | 21 +++++++++++++++++++++
 ooni/ui/cli.py            |  7 +++++--
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ooni/scripts/ooniprobe.py b/ooni/scripts/ooniprobe.py
index e8b9af4..9459813 100644
--- a/ooni/scripts/ooniprobe.py
+++ b/ooni/scripts/ooniprobe.py
@@ -7,9 +7,14 @@ from twisted.internet import task, defer
 def ooniprobe(reactor):
     from ooni.ui.cli import runWithDaemonDirector, runWithDirector
     from ooni.ui.cli import setupGlobalOptions, initializeOoniprobe
+    from ooni.settings import config
 
     global_options = setupGlobalOptions(logging=True, start_tor=True,
                                         check_incoherences=True)
+    if global_options['info']:
+        config.log_info()
+        return defer.succeed(None)
+
     if global_options['queue']:
         return runWithDaemonDirector(global_options)
 
diff --git a/ooni/settings.py b/ooni/settings.py
index 48dd1f3..ed2d1e1 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -349,6 +349,27 @@ class OConfig(object):
             if os.path.isfile(file_path):
                 return file_path
 
+    def log_info(self):
+        log.msg("Paths")
+        log.msg("-----")
+        log.msg("inputs directory: %s" % self.inputs_directory)
+        log.msg("scheduler directory: %s" % self.scheduler_directory)
+        log.msg("resources directory: %s" % self.resources_directory)
+        log.msg("decks available directory: %s" % self.decks_available_directory)
+        log.msg("decks enabled directory: %s" % self.decks_enabled_directory)
+        log.msg("measurements directory: %s" % self.measurements_directory)
+
+        log.msg("running path: %s" % self.running_path)
+        log.msg("config files: %s" % ','.join(self.config_files))
+        log.msg("ooni home: %s" % self.ooni_home)
+        log.msg("var_lib path: %s" % VAR_LIB_PATH)
+        log.msg("etc path: %s" % ETC_PATH)
+        log.msg("usr_share path: %s" % USR_SHARE_PATH)
+
+        log.debug("nettest directory: %s" % self.nettest_directory)
+        log.debug("web ui directory: %s" % self.web_ui_directory)
+
+
     def set_paths(self):
         self.nettest_directory = os.path.join(OONIPROBE_ROOT, 'nettests')
         self.web_ui_directory = os.path.join(OONIPROBE_ROOT, 'ui', 'web',
diff --git a/ooni/ui/cli.py b/ooni/ui/cli.py
index fed9606..6228d2f 100644
--- a/ooni/ui/cli.py
+++ b/ooni/ui/cli.py
@@ -33,6 +33,7 @@ class Options(usage.Options):
                 ["web-ui", "w", "Start the web UI"],
                 ["initialize", "z", "Initialize ooniprobe to begin running "
                                     "it"],
+                ["info", None, "Print system wide info and exit"]
                 ]
 
     optParameters = [
@@ -61,7 +62,8 @@ class Options(usage.Options):
                                          "communicating with test helpers. "
                                          "Can be either onion, "
                                          "https or cloudfront"],
-        ["queue", "Q", None, "AMQP Queue URL amqp://user:pass@host:port/vhost/queue"]
+        ["queue", "Q", None, "AMQP Queue URL "
+                             "amqp://user:pass@host:port/vhost/queue"]
     ]
 
     compData = usage.Completions(
@@ -90,7 +92,8 @@ class Options(usage.Options):
         sys.exit(0)
 
     def parseArgs(self, *args):
-        if self['testdeck'] or self['list'] or self['web-ui']:
+        flag_opts = ['testdeck', 'list', 'web-ui', 'info']
+        if any([self[opt] for opt in flag_opts]):
             return
         try:
             self['test_file'] = args[0]



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