[tor-commits] [sbws/master] Remove init dependency and create default dirs
pastly at torproject.org
pastly at torproject.org
Thu Aug 9 14:21:20 UTC 2018
commit b28c6c6fdbc8f348463ac0f301993084e136abf2
Author: juga0 <juga at riseup.net>
Date: Wed Jul 18 19:56:58 2018 +0000
Remove init dependency and create default dirs
---
sbws/sbws.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/sbws/sbws.py b/sbws/sbws.py
index a97e428..64d126c 100644
--- a/sbws/sbws.py
+++ b/sbws/sbws.py
@@ -1,7 +1,8 @@
+import os
+
import sbws.core.cleanup
import sbws.core.scanner
import sbws.core.generate
-import sbws.core.init
import sbws.core.stats
from sbws.util.config import get_config
from sbws.util.config import validate_config
@@ -16,6 +17,13 @@ import logging
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'])
+
+
def _adjust_log_level(args, conf):
if not args.log_level:
return
@@ -33,6 +41,7 @@ def main():
parser = create_parser()
args = parser.parse_args()
conf = get_config(args)
+ _ensure_dirs(conf)
_adjust_log_level(args, conf)
conf_valid, conf_errors = validate_config(conf)
if not conf_valid:
@@ -49,8 +58,6 @@ def main():
'a': def_args, 'kw': def_kwargs},
'generate': {'f': sbws.core.generate.main,
'a': def_args, 'kw': def_kwargs},
- 'init': {'f': sbws.core.init.main,
- 'a': def_args, 'kw': def_kwargs},
'stats': {'f': sbws.core.stats.main,
'a': def_args, 'kw': def_kwargs},
}
More information about the tor-commits
mailing list