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

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



commit 93e454e2328f2ed427d844c72bcc74cafd34ec52
Author: Matt Traudt <sirmatt@xxxxxxx>
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)."



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