[tor-commits] [nyx/master] Include user's torrc in trace debug output

atagar at torproject.org atagar at torproject.org
Fri Nov 3 19:30:54 UTC 2017


commit 0b35f7312eae7fde52b30f23ee751f420868cab5
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Nov 3 12:29:15 2017 -0700

    Include user's torrc in trace debug output
    
    Oops, just realized that we include the nyxrc but not the user's torrc (which
    is a hell of a lot more important!).
---
 nyx/starter.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/nyx/starter.py b/nyx/starter.py
index 62c8287..826475e 100644
--- a/nyx/starter.py
+++ b/nyx/starter.py
@@ -36,6 +36,13 @@ Nyx Configuration ({nyxrc_path}):
 --------------------------------------------------------------------------------
 """.strip()
 
+TORRC = """
+--------------------------------------------------------------------------------
+Torrc ({torrc_path}):
+{torrc_content}
+--------------------------------------------------------------------------------
+""".rstrip()
+
 
 @uses_settings
 def main(config):
@@ -81,6 +88,17 @@ def main(config):
   if controller is None:
     exit(1)
 
+  if args.debug_path is not None:
+    torrc_path = controller.get_info('config-file')
+
+    try:
+      with open(torrc_path) as torrc_file:
+        torrc_content = torrc_file.read()
+    except Exception as exc:
+      torrc_content = 'Unable to read %s: %s' % (torrc_path, exc)
+
+    stem.util.log.trace(TORRC.format(torrc_path = torrc_path, torrc_content = torrc_content))
+
   _warn_if_root(controller)
   _warn_if_unable_to_get_pid(controller)
   _warn_about_unused_config_keys()





More information about the tor-commits mailing list