[tor-commits] [sbws/master] Use conf.getint and getpath

pastly at torproject.org pastly at torproject.org
Wed Sep 5 19:44:55 UTC 2018


commit 5e363d8b9bba1225029a2317c0d58673429585e8
Author: Matt Traudt <sirmatt at ksu.edu>
Date:   Wed Sep 5 10:56:31 2018 -0400

    Use conf.getint and getpath
    
    getpath is necessary so that ~ is expanded
    
    GH: closes #241
    trac: implements #26937
---
 sbws/util/fs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbws/util/fs.py b/sbws/util/fs.py
index 9621b6f..c7a5de7 100644
--- a/sbws/util/fs.py
+++ b/sbws/util/fs.py
@@ -20,7 +20,7 @@ def sbws_required_disk_space(conf):
     # ~1000 is the length of a line when the result is successfull
     # ~4550 is the number of lines of the biggest result file
     size_result_file = 4550 * 1000
-    num_result_files = int(conf['general']['data_period'])
+    num_result_files = conf.getint('general', 'data_period')
     # not counting compressed files
     space_v3bw_files = size_v3bw_file * num_v3bw_files
     space_result_files = size_result_file * num_result_files
@@ -48,7 +48,7 @@ def is_low_space(conf):
     what is needed for sbws and False otherwise needs.
     """
     disk_required_mb = sbws_required_disk_space(conf)
-    disk_avail_mb = df(conf['paths']['sbws_home'])
+    disk_avail_mb = df(conf.getpath('paths', 'sbws_home'))
     if disk_avail_mb < disk_required_mb:
         log.warn("The space left on the device (%s MiB) is less than "
                  "the minimum recommended to run sbws (%s MiB)."





More information about the tor-commits mailing list