Hi List!

In the yum cli, when your debuglevel is less than 2, the rpm callback
object had output set to 0. In yum-updatesd, output was always 0.
This value for output was used both to determine if stuff would get
printed to stdout, and if stuff would be sent to the sys/filelogs.
That's not what we want though; we should always sent to the
sys/filelogs when doing a real rpm transaction.

The attached patch adds a boolean to the callback object, filelog. If
true, then we send stuff to the sys/filelogs. In practice this makes the
code look similar to how it was pre-logger-gate.

Feedback and flames appreciated.

-James
diff --git a/callback.py b/callback.py
index feb6759..3a24b10 100644
--- a/callback.py
+++ b/callback.py
@@ -34,6 +34,7 @@ class RPMInstallCallback:
         self.mark = "#"
         self.marks = 27
         self.logger = logging.getLogger('yum.filelogging.RPMInstallCallback')
+        self.filelog = False
 
         self.myprocess = { TS_UPDATE : 'Updating', 
                            TS_ERASE: 'Erasing',
@@ -137,7 +138,7 @@ class RPMInstallCallback:
                     except KeyError:
                         pass
 
-                    if self.output:
+                    if self.filelog:
                         pkgrep = self._logPkgString(hdr)
                         msg = '%s: %s' % (processed, pkgrep)
                         self.logger.info(msg)
diff --git a/cli.py b/cli.py
index 0899ef1..14e44b9 100644
--- a/cli.py
+++ b/cli.py
@@ -450,6 +450,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         if self.conf.debuglevel < 2:
             output = 0
         cb = callback.RPMInstallCallback(output=output)
+        cb.filelog = True
         cb.tsInfo = self.tsInfo
 
         self.verbose_logger.log(yum.logginglevels.INFO_2, 'Running Transaction')
diff --git a/yum-updatesd.py b/yum-updatesd.py
index 7e41243..b27b2cd 100644
--- a/yum-updatesd.py
+++ b/yum-updatesd.py
@@ -286,8 +286,8 @@ class UpdateInstallThread(threading.Thread):
         self.updd.ts.check() #required for ordering
         self.updd.ts.order() # order
         cb = callback.RPMInstallCallback(output = 0)
+        cb.filelog = True
             
-        # FIXME: need to do filelog
         cb.tsInfo = self.updd.tsInfo
         try:
             self.updd.runTransaction(cb=cb)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to