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

[PATCH 1/3] Only try logging to tty3 if we have permission to do so.



It should be possible to import this module as non-root, which this
patch makes possible.
---
 pyanaconda/network.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 9cad759..9b5f197 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -55,10 +55,11 @@ from pyanaconda import anaconda_log
 logger = logging.getLogger("ifcfg")
 logger.setLevel(logging.DEBUG)
 anaconda_log.logger.addFileHandler(ifcfgLogFile, logger, logging.DEBUG)
-anaconda_log.logger.addFileHandler("/dev/tty3", logger,
-                                   anaconda_log.DEFAULT_TTY_LEVEL,
-                                   anaconda_log.TTY_FORMAT,
-                                   autoLevel=True)
+if os.access("/dev/tty3", os.W_OK):
+    anaconda_log.logger.addFileHandler("/dev/tty3", logger,
+                                       anaconda_log.DEFAULT_TTY_LEVEL,
+                                       anaconda_log.TTY_FORMAT,
+                                       autoLevel=True)
 anaconda_log.logger.forwardToSyslog(logger)
 
 ifcfglog = logging.getLogger("ifcfg")
-- 
1.7.3.2


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