[yum-commits] etc/yum-cron.conf yum-cron/yum-cron.py yum/logginglevels.py

zpavlas at osuosl.org zpavlas at osuosl.org
Wed Jul 24 12:21:27 UTC 2013


 etc/yum-cron.conf    |    6 ++++++
 yum-cron/yum-cron.py |    5 ++---
 yum/logginglevels.py |    4 +++-
 3 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit cd8510b831c3b2f86083a2d43c2e245b5052e7aa
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Wed Jul 24 10:59:22 2013 +0200

    Add debuglevels -2, -3, -4. BZ 873428, BZ 982088
    
    -4: critical
    -3: critical+errors
    -2: critical+errors+warnings
    
    Main user for this is yum-cron.  Added "debuglevel" option
    to yum-cron.conf, defaulting to -2.  Also fixed a bug that
    prevented yum-cron to be run as user (setCacheDir removes
    the preconf attribute)

diff --git a/etc/yum-cron.conf b/etc/yum-cron.conf
index 3fc756e..56940ff 100644
--- a/etc/yum-cron.conf
+++ b/etc/yum-cron.conf
@@ -64,6 +64,12 @@ group_list = None
 group_package_types = mandatory, default
 
 [base]
+# Use this to filter Yum core messages
+# -4: critical
+# -3: critical+errors
+# -2: critical+errors+warnings (default)
+debuglevel = -2
+
 # override yum options of the same name
 # skip_broken = True
 
diff --git a/yum-cron/yum-cron.py b/yum-cron/yum-cron.py
index 26526b7..74eb6d7 100755
--- a/yum-cron/yum-cron.py
+++ b/yum-cron/yum-cron.py
@@ -709,6 +709,7 @@ class YumCronConfig(BaseConfig):
     group_list = ListOption([])
     group_package_types = ListOption(['mandatory', 'default'])
     skip_broken = BoolOption()
+    debuglevel = IntOption(-2, -4, 10)
 
 
 class YumCronBase(yum.YumBase):
@@ -792,14 +793,12 @@ class YumCronBase(yum.YumBase):
         try :
             # Set the configuration file
             self.preconf.fn = self.opts.yum_config_file
+            self.preconf.debuglevel = self.opts.debuglevel
 
             # if we are not root do the special subdir thing
             if os.geteuid() != 0:
                 self.setCacheDir()
 
-            # Turn off the plugins line
-            self.preconf.debuglevel = 0
-
             # Create the configuration
             self.conf
 
diff --git a/yum/logginglevels.py b/yum/logginglevels.py
index dfdd90c..8a811ae 100644
--- a/yum/logginglevels.py
+++ b/yum/logginglevels.py
@@ -87,7 +87,9 @@ def logLevelFromErrorLevel(error_level):
 
 def logLevelFromDebugLevel(debug_level):
     """ Convert an old-style debug logging level to the new style. """
-    debug_table = {-1 : __NO_LOGGING, 0 : logging.INFO, 1 : INFO_1, 2 : INFO_2,
+    debug_table = {
+        -4 : logging.CRITICAL, -3 : logging.ERROR, -2 : logging.WARNING,
+        -1 : __NO_LOGGING, 0 : logging.INFO, 1 : INFO_1, 2 : INFO_2,
         3 : logging.DEBUG, 4 : DEBUG_1, 5 : DEBUG_2, 6 : DEBUG_3, 7 : DEBUG_4}
 
     return __convertLevel(debug_level, debug_table)


More information about the Yum-commits mailing list