From: "Brian C. Lane" <bcl(a)redhat.com>
The second instance of rsyslog is not needed, and it interferes with
virtio logging. The yum and rpm file io logging will be dealt with
in another patch.
---
pyanaconda/backend_log.py | 95 ----------------------------------
pyanaconda/packaging/__init__.py | 27 ----------
pyanaconda/packaging/yumpayload.py | 15 +-----
pyanaconda/ui/gui/tools/run-spoke.py | 1 -
4 files changed, 2 insertions(+), 136 deletions(-)
delete mode 100644 pyanaconda/backend_log.py
diff --git a/pyanaconda/backend_log.py b/pyanaconda/backend_log.py
deleted file mode 100644
index 9125d73..0000000
--- a/pyanaconda/backend_log.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# backend_log.py
-# Logging infrastructure for Anaconda's backend.
-#
-# Copyright (C) 2009 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions of
-# the GNU General Public License v.2, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY expressed or implied, including the implied warranties of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details. You should have received a copy of the
-# GNU General Public License along with this program; if not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
-# source code or documentation are not subject to the GNU General Public
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-#
-# Red Hat Author(s): Ales Kozumplik <akozumpl(a)redhat.com>
-#
-
-import logging
-import os
-import signal
-
-import anaconda_log
-import iutil
-
-SYSLOG_PATH = '/sbin/rsyslogd'
-SYSLOG_PIDFILE = '/var/run/rsyslog_backend.pid'
-SYSLOG_CFGFILE = '/tmp/rsyslog_backend.conf'
-
-CFG_TEMPLATE = """
-$ModLoad imuxsock
-$InputUnixListenSocketHostName sysimage
-$AddUnixListenSocket %(socket)s
-+sysimage
-*.* %(logfile)s;RSYSLOG_TraditionalFileFormat
-%(remote_syslog)s
-"""
-
-global_log = logging.getLogger("anaconda")
-class BackendSyslog:
- def __init__(self):
- pass
-
- def build_cfg(self, root, log):
- socket = "%s/dev/log" % (root, )
- remote_syslog = ''
- if anaconda_log.logger.remote_syslog:
- remote_syslog = "*.* @@%s" % (anaconda_log.logger.remote_syslog, )
-
- cfg = CFG_TEMPLATE % {
- 'socket' : socket,
- 'logfile' : log,
- 'remote_syslog' : remote_syslog
- }
- with open(SYSLOG_CFGFILE, 'w') as cfg_file:
- cfg_file.write(cfg)
-
- def start(self, root, log):
- """ Start an rsyslogd instance dedicated for the sysimage.
-
- Other possibility would be to change configuration and SIGHUP the
- existing instance, but it could lose some of its internal queues and
- give us problems with remote logging.
- """
- self.build_cfg(root, log)
- args = ['-c', '4',
- '-f', SYSLOG_CFGFILE,
- '-i', str(SYSLOG_PIDFILE)]
- status = iutil.execWithRedirect(SYSLOG_PATH, args)
- if status == 0:
- global_log.info("Backend logger started.")
- else:
- global_log.error("Unable to start backend logger")
-
- def stop(self):
- try:
- with open(SYSLOG_PIDFILE, 'r') as pidfile:
- pid = int(pidfile.read())
- os.kill(pid, signal.SIGKILL)
- except Exception:
- pass
- else:
- global_log.info("Backend logger stopped.")
-
- try:
- os.unlink(SYSLOG_CFGFILE)
- except OSError as e:
- global_log.error("Failed to unlink backend logger config file: %s"
- % e)
-
-log = BackendSyslog()
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 02a1a5d..19316e3 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -50,8 +50,6 @@ from pykickstart.parser import Group
import logging
log = logging.getLogger("anaconda")
-from pyanaconda.backend_log import log as instlog
-
from pyanaconda.errors import *
#from pyanaconda.progress import progress
@@ -472,27 +470,6 @@ class Payload(object):
""" Perform pre-installation tasks. """
iutil.mkdirChain(ROOT_PATH + "/root")
- if self.data.upgrade.upgrade:
- mode = "upgrade"
- else:
- mode = "install"
-
- log_file_name = "%s.log" % mode
- log_file_path = "%s/root/%s" % (ROOT_PATH, log_file_name)
- try:
- shutil.rmtree (log_file_path)
- except OSError:
- pass
-
- self.install_log = open(log_file_path, "w+")
-
- syslogname = "%s.syslog" % log_file_path
- try:
- shutil.rmtree (syslogname)
- except OSError:
- pass
- instlog.start(ROOT_PATH, syslogname)
-
if packages is not None:
map(self.selectPackage, packages)
@@ -595,10 +572,6 @@ class Payload(object):
self._copyDriverDiskFiles()
- # stop logger
- instlog.stop()
-
-
class ImagePayload(Payload):
""" An ImagePayload installs an OS image to the target system. """
def __init__(self, data):
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 85f534c..0273c1b 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -1002,13 +1002,8 @@ reposdir=%s
self._yum.ts.order()
self._yum.ts.clean()
- # set up rpm logging to go to our log
- self._yum.ts.ts.scriptFd = self.install_log.fileno()
- rpm.setLogFile(self.install_log)
-
# create the install callback
- rpmcb = RPMCallback(self._yum, self.install_log,
- upgrade=self.data.upgrade.upgrade)
+ rpmcb = RPMCallback(self._yum, upgrade=self.data.upgrade.upgrade)
if flags.testing:
self._yum.ts.setFlags(rpm.RPMTRANS_FLAG_TEST)
@@ -1038,10 +1033,8 @@ reposdir=%s
raise exn
else:
log.info("transaction complete")
- self.install_log.write("*** FINISHED INSTALLING PACKAGES ***")
progress.send_step()
finally:
- self.install_log.close()
self._yum.ts.close()
iutil.resetRpmDb()
@@ -1069,9 +1062,8 @@ reposdir=%s
super(YumPayload, self).postInstall()
class RPMCallback(object):
- def __init__(self, yb, log, upgrade=False):
+ def __init__(self, yb, upgrade=False):
self._yum = yb # yum.YumBase
- self.install_log = log # file instance
self.upgrade = upgrade # boolean
self.package_file = None # file instance (package file management)
@@ -1134,9 +1126,6 @@ class RPMCallback(object):
self.completed_actions,
self.total_actions)
log.info(log_msg)
- self.install_log.write("%s %s\n" % (time.strftime("%H:%M:%S"),
- log_msg))
- self.install_log.flush()
progress.send_message(progress_msg)
self.package_file = None
diff --git a/pyanaconda/ui/gui/tools/run-spoke.py b/pyanaconda/ui/gui/tools/run-spoke.py
index 6114155..5f5a44a 100755
--- a/pyanaconda/ui/gui/tools/run-spoke.py
+++ b/pyanaconda/ui/gui/tools/run-spoke.py
@@ -98,7 +98,6 @@ instclass = DefaultInstall()
payload = YumPayload(ksdata)
payload.setup(storage)
-payload.install_log = sys.stdout
spoke = spokeClass(ksdata, storage, payload, instclass)
if hasattr(spoke, "register_event_cb"):
--
1.7.7.6