diff --git a/anaconda b/anaconda
index 6ca3391..676b033 100755
--- a/anaconda
+++ b/anaconda
@@ -37,10 +37,6 @@ from tempfile import mkstemp
# keep up with process ID of the window manager if we start it
wm_pid = None
-# Make sure messages sent through python's warnings module get logged.
-def AnacondaShowWarning(message, category, filename, lineno, file=sys.stderr, line=None):
- log.warning("%s" % warnings.formatwarning(message, category, filename, lineno, line))
-
def startMetacityWM():
childpid = os.fork()
if not childpid:
@@ -575,7 +571,6 @@ if __name__ == "__main__":
isys.initLog()
import signal, string, time
- import warnings
from pyanaconda import iutil
from pyanaconda import vnc
@@ -586,7 +581,6 @@ if __name__ == "__main__":
import iutil
from flags import flags
@@ -120,9 +121,10 @@ class AnacondaLog:
logging.addLevelName(logging.CRITICAL, "CRIT")
# Create the base of the logger hierarchy.
- anaconda_logger = logging.getLogger("anaconda")
- self.addFileHandler(MAIN_LOG_FILE, anaconda_logger,
+ self.anaconda_logger = logging.getLogger("anaconda")
+ self.addFileHandler(MAIN_LOG_FILE, self.anaconda_logger,
minLevel=logging.DEBUG)
+ warnings.showwarning = self.showwarning
# Create the storage logger.
storage_logger = logging.getLogger("storage")
@@ -130,7 +132,7 @@ class AnacondaLog:
minLevel=logging.DEBUG)
# Set the common parameters for anaconda and storage loggers.
- for logger in [anaconda_logger, storage_logger]:
+ for logger in [self.anaconda_logger, storage_logger]:
logger.setLevel(logging.DEBUG)
self.forwardToSyslog(logger)
# Logging of basic stuff and storage to tty3.
@@ -190,6 +192,16 @@ class AnacondaLog:
syslogHandler.setLevel(logging.DEBUG)
logger.addHandler(syslogHandler)
+ def showwarning(self, message, category, filename, lineno,
+ file=sys.stderr, line=None):
+ """ Make sure messages sent through python's warnings module get logged.
+
+ The warnings mechanism is used by some libraries we use,
+ notably pykickstart.
+ """
+ self.anaconda_logger.warning("%s" % warnings.formatwarning(
+ message, category, filename, lineno, line))
+
def updateRemote(self, remote_syslog):
"""Updates the location of remote rsyslogd to forward to.
# Special check for this, since it doesn't make any sense.
if packagesSeen:
- warnings.warn("Ignoring contents of %packages section due to upgrade.")
+ log.warning("Ignoring contents of %packages section due to upgrade.")
elif havePackages(ksdata.packages):
dispatch.skip_steps("tasksel", "group-selection")
else:
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index da10e97..69275ee 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -26,7 +26,6 @@ import os
import os.path
import shutil
import time
-import warnings
import types
import locale
import glob
--
1.7.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list