[Yum-devel] [PATCH] Allow plugins to signal exit status, bump plugin API version to 2.7.
Ville Skyttä
ville.skytta at iki.fi
Fri Nov 5 14:47:38 UTC 2010
Useful for example for downloadonly, BZ 531323.
---
yum/plugins.py | 5 +++--
yummain.py | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
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 0241684..6a62753 100755
--- a/yummain.py
+++ b/yummain.py
@@ -60,7 +60,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', to_unicode(e.value))
--
1.7.2.3
More information about the Yum-devel
mailing list