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

[tor-commits] [sbws/master] Add forgotten exist_ok param when creating dirs



commit f6021532fd21969dd4f845efa0aa795c6d23d191
Author: juga0 <juga@xxxxxxxxxx>
Date:   Mon Jul 23 22:37:47 2018 +0000

    Add forgotten exist_ok param when creating dirs
---
 sbws/sbws.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sbws/sbws.py b/sbws/sbws.py
index 64d126c..6481df6 100644
--- a/sbws/sbws.py
+++ b/sbws/sbws.py
@@ -18,10 +18,12 @@ log = logging.getLogger(__name__)
 
 
 def _ensure_dirs(conf):
-    log.debug('Ensuring all dirs exits.')
-    os.makedirs(conf['paths']['datadir'])
-    os.makedirs(conf['paths']['v3bw'])
-    os.makedirs(conf['paths']['log'])
+    log.debug('Ensuring all dirs exists.')
+    # it is not needed to check sbws_home dir, since the following
+    # will create parent dirs too (in case they don't exist)
+    os.makedirs(conf['paths']['datadir'], exist_ok=True)
+    os.makedirs(conf['paths']['v3bw_dname'], exist_ok=True)
+    os.makedirs(conf['paths']['log_dname'], exist_ok=True)
 
 
 def _adjust_log_level(args, conf):



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