[tor-commits] [sbws/master] Replace conf['tor']x by conf.getpath('tor', x)

pastly at torproject.org pastly at torproject.org
Thu Aug 9 14:21:20 UTC 2018


commit 75d93f803fb8659999c98a0c925808bbada97e1e
Author: juga0 <juga at riseup.net>
Date:   Tue Jul 24 17:40:43 2018 +0000

    Replace conf['tor']x by conf.getpath('tor', x)
    
    and use correct paths
---
 sbws/util/stem.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index 566261b..8e57f96 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -120,15 +120,17 @@ def _init_controller_socket(socket):
 def launch_tor(conf):
     assert isinstance(conf, ConfigParser)
     os.makedirs(conf.getpath('tor', 'datadir'), mode=0o700, exist_ok=True)
+    os.makedirs(conf.getpath('tor', 'run_dpath'), mode=0o700, exist_ok=True)
     # Bare minimum things, more or less
     torrc = copy.deepcopy(TORRC_STARTING_POINT)
     # Very important and/or common settings that we don't know until runtime
     torrc.update({
-        'DataDirectory': conf['tor']['datadir'],
-        'PidFile': os.path.join(conf['tor']['datadir'], 'tor.pid'),
-        'ControlSocket': conf['tor']['control_socket'],
+        'DataDirectory': conf.getpath('tor', 'datadir'),
+        'PidFile': conf.getpath('tor', 'pid'),
+        'ControlSocket': conf.getpath('tor', 'control_socket'),
         'Log': [
-            'NOTICE file {}'.format(conf['tor']['log']),
+            'NOTICE file {}'.format(os.path.join(conf.getpath('tor', 'log'),
+                                                 'notice.log')),
         ],
         # Things needed to make circuits fail a little faster. We get the
         # circuit_timeout as a string instead of an int on purpose: stem only





More information about the tor-commits mailing list