[yum-commits] Branch 'yum-3_2_X' - yummain.py yum/plugins.py

Ville Skyttä scop at osuosl.org
Thu Apr 7 17:30:35 UTC 2011


 yum/plugins.py |    5 +++--
 yummain.py     |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit d14bdfe42073859f4c28476e4394e466047c3bfb
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Nov 5 16:43:58 2010 +0200

    Allow plugins to signal exit status, bump plugin API version to 2.7.
    
    Useful for example for downloadonly, BZ 531323.

diff --git a/yum/plugins.py b/yum/plugins.py
index bfc49b7..eecaa22 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -63,7 +63,7 @@ from yum.i18n import utf8_width
 # API, the major version number must be incremented and the minor version number
 # reset to 0. If a change is made that doesn't break backwards compatibility,
 # then the minor number must be incremented.
-API_VERSION = '2.6'
+API_VERSION = '2.7'
 
 class DeprecatedInt(int):
     '''
@@ -107,9 +107,10 @@ SLOTS = sorted(SLOT_TO_CONDUIT.keys())
 class PluginYumExit(Exception):
     '''Used by plugins to signal that yum should stop
     '''
-    def __init__(self, value="", translation_domain=""):
+    def __init__(self, value="", translation_domain="", exitstatus=1):
         self.value = value
         self.translation_domain = translation_domain
+        self.exitstatus = exitstatus
     def __str__(self):
         if self.translation_domain:
             return gettext.dgettext(self.translation_domain, self.value)
diff --git a/yummain.py b/yummain.py
index 1b94153..beb1267 100755
--- a/yummain.py
+++ b/yummain.py
@@ -61,7 +61,7 @@ def main(args):
         if exitmsg:
             logger.warn('\n\n%s', exitmsg)
         if unlock(): return 200
-        return 1
+        return e.exitstatus
 
     def exFatal(e):
         logger.critical('\n\n%s', exception2msg(e.value))


More information about the Yum-commits mailing list