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

zpavlas at osuosl.org zpavlas at osuosl.org
Mon Aug 26 08:30:08 UTC 2013


 etc/yum-cron.conf    |    7 +++++--
 yum-cron/yum-cron.py |   17 +++++++++--------
 yum/config.py        |    2 +-
 3 files changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 3fb152e39933614456bea0ee18e31dc591768fe0
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Fri Aug 16 10:57:16 2013 +0200

    yum-cron: use the [base] section to override yum.conf. BZ 968529
    
    - Drop yum-cron's options skip_broken and debuglevel, since
      now the whole [base] section is haddled by Yum core.
    - Change the Yum debuglevel option range to -4..10.
    - Add "assumeyes" template to yum-cron.conf.

diff --git a/etc/yum-cron.conf b/etc/yum-cron.conf
index 5c59869..649c326 100644
--- a/etc/yum-cron.conf
+++ b/etc/yum-cron.conf
@@ -64,13 +64,16 @@ group_list = None
 group_package_types = mandatory, default
 
 [base]
+# This section overrides yum.conf
+
 # 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
-
 mdpolicy = group:main
+
+# Uncomment to auto-import new gpg keys (dangerous)
+# assumeyes = True
diff --git a/yum-cron/yum-cron.py b/yum-cron/yum-cron.py
index 735f496..d56a1b6 100755
--- a/yum-cron/yum-cron.py
+++ b/yum-cron/yum-cron.py
@@ -709,8 +709,6 @@ class YumCronConfig(BaseConfig):
     yum_config_file = Option("/etc/yum.conf")
     group_list = ListOption([])
     group_package_types = ListOption(['mandatory', 'default'])
-    skip_broken = BoolOption()
-    debuglevel = IntOption(-2, -4, 10)
 
 
 class YumCronBase(yum.YumBase):
@@ -765,7 +763,7 @@ class YumCronBase(yum.YumBase):
         self.opts.populate(confparser, 'emitters')
         self.opts.populate(confparser, 'email')
         self.opts.populate(confparser, 'groups')
-        self.opts.populate(confparser, 'base')
+        self._confparser = confparser
 
         #If the system name is not given, set it by getting the hostname
         if self.opts.system_name == 'None' :
@@ -795,7 +793,10 @@ class YumCronBase(yum.YumBase):
         try :
             # Set the configuration file
             self.preconf.fn = self.opts.yum_config_file
-            self.preconf.debuglevel = self.opts.debuglevel
+
+            # This needs to be set early, errors are handled later.
+            try: self.preconf.debuglevel = int(self._confparser.get('base', 'debuglevel'))
+            except: pass
 
             # if we are not root do the special subdir thing
             if os.geteuid() != 0:
@@ -804,16 +805,16 @@ class YumCronBase(yum.YumBase):
             # Create the configuration
             self.conf
 
+            # override base yum options
+            self.conf.populate(self._confparser, 'base')
+            del self._confparser
+
         except Exception, e:
             # If there are any exceptions, send a message about them,
             # and return False
             self.emitSetupFailed('%s' % e)
             sys.exit(1)
 
-        # override yum options
-        if self.opts.skip_broken is not None:
-            self.conf.skip_broken = self.opts.skip_broken
-
     def acquireLock(self):
         """ Wrapper method around doLock to emit errors correctly."""
 
diff --git a/yum/config.py b/yum/config.py
index cd3ef2e..1d446c0 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -710,7 +710,7 @@ class StartupConf(BaseConfig):
     the other [main] options can be parsed.
     """
     # xemacs highlighting hack: '
-    debuglevel = IntOption(2, 0, 10)
+    debuglevel = IntOption(2, -4, 10)
     errorlevel = IntOption(2, 0, 10)
 
     distroverpkg = Option('redhat-release')


More information about the Yum-commits mailing list