[tor-commits] [nyx/master] Reduce runlevel of message about lacking cache write access

atagar at torproject.org atagar at torproject.org
Mon Dec 4 20:01:16 UTC 2017


commit 1e0f9a12728e5fbeaa9e9026ee542e8944a04930
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Dec 4 11:59:35 2017 -0800

    Reduce runlevel of message about lacking cache write access
    
    When nyx is run as a user without a home directory or one we can't write to
    users get a notice...
    
      https://trac.torproject.org/projects/tor/ticket/24508
    
    This is fine. If we can't make our cache we already disable it.
---
 nyx/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nyx/__init__.py b/nyx/__init__.py
index 256764f..408681c 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -339,7 +339,8 @@ def data_directory(filename, config):
     try:
       os.makedirs(data_dir)
     except OSError as exc:
-      stem.util.log.log_once('nyx.data_directory_unavailable', stem.util.log.NOTICE, 'Unable to create a data directory at %s (%s). This is fine, but caching is disabled meaning performance will be diminished a bit.' % (data_dir, exc))
+      msg_runlevel = stem.util.log.INFO if 'Permission denied' in str(exc) else stem.util.log.NOTICE
+      stem.util.log.log_once('nyx.data_directory_unavailable', msg_runlevel, 'Unable to create a data directory at %s (%s). This is fine, but caching is disabled meaning performance will be diminished a bit.' % (data_dir, exc))
       return None
 
   return os.path.join(data_dir, filename)



More information about the tor-commits mailing list