Bug 1144503 - yum-plugin-downloadonly exists with error code 1 on success
Summary: yum-plugin-downloadonly exists with error code 1 on success
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: yum
Version: 6.6
Hardware: All
OS: All
medium
low
Target Milestone: rc
: ---
Assignee: Valentina Mukhamedzhanova
QA Contact: Marek Marusic
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 1075802 1159926
TreeView+ depends on / blocked
 
Reported: 2014-09-19 14:56 UTC by Felix Dewaleyne
Modified: 2015-07-22 07:21 UTC (History)
7 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2015-07-22 07:21:26 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1384 normal SHIPPED_LIVE yum bug fix and enhancement update 2015-07-20 18:07:41 UTC
Red Hat Knowledge Base (Solution) 879063 None None None Never

Description Felix Dewaleyne 2014-09-19 14:56:24 UTC
Description of problem:
yum-plugin-downloadonly exists with error code 1 on success

Version-Release number of selected component (if applicable):
all versions of yum-plugin-downloadonly 

How reproducible:
all the time

Steps to Reproduce:
1. yum install yum-plugin-downloadonly
2. yum update --downloadonly
3. echo $?

Actual results:
return code 1 with a successful download

Expected results:
return code 0

Additional info:
repeated the test on fedora as yum-plugin-downloadonly has been incorporated into yum in that version - the exit code as of  yum-3.4.3-152.fc20.noarch has been fixed.

Comment 2 Troy Dawson 2014-09-24 15:46:58 UTC
The problem is that the plugin is using PluginYumExit to exit.  PluginYumExit is for exceptions, and thus will always throw a 1 or higher.
If the plugin switches to using sys.exit() it will get a proper exitcode.
Here is what I currently use as a work-around.  You are free to use this if you want.

--- downloadonly.py.original	2014-09-24 09:59:50.272309627 -0500
+++ downloadonly.py	2014-09-24 10:39:36.063628706 -0500
@@ -17,6 +17,7 @@
 # by Menno Smits
 
 from yum.plugins import PluginYumExit, TYPE_INTERACTIVE
+import sys
 
 requires_api_version = '2.1'
 plugin_type = (TYPE_INTERACTIVE,)
@@ -45,4 +46,6 @@
     opts, commands = conduit.getCmdLine()
     # Don't die on errors, or we'll never see them.
     if not conduit.getErrors() and opts.dlonly:
-        raise PluginYumExit('exiting because --downloadonly specified ')
+    	# We have no errors, so exitcode should be 0
+    	conduit.info(2, 'exiting because --downloadonly specified')
+        sys.exit(0)

Comment 3 Troy Dawson 2014-09-24 15:57:55 UTC
Sorry for the tab/spaces error there ... this works better.


--- downloadonly.py.original	2014-09-24 09:59:50.272309627 -0500
+++ downloadonly.py	2014-09-24 10:56:40.915588257 -0500
@@ -17,6 +17,7 @@
 # by Menno Smits
 
 from yum.plugins import PluginYumExit, TYPE_INTERACTIVE
+import sys
 
 requires_api_version = '2.1'
 plugin_type = (TYPE_INTERACTIVE,)
@@ -45,4 +46,6 @@
     opts, commands = conduit.getCmdLine()
     # Don't die on errors, or we'll never see them.
     if not conduit.getErrors() and opts.dlonly:
-        raise PluginYumExit('exiting because --downloadonly specified ')
+        # We have no errors, so exitcode should be 0
+        conduit.info(2, 'exiting because --downloadonly specified')
+        sys.exit(0)

Comment 4 Karel Srot 2014-11-24 19:03:37 UTC
So I guess this is a yum-utils bug then.

Comment 5 Felix Dewaleyne 2014-11-25 09:46:27 UTC
well I don't know, that looks like the updates from Troy fix something in dowloadonly.py to me.

Comment 6 Karel Srot 2014-11-25 10:12:09 UTC
Yep, that would be /usr/lib/yum-plugins/downloadonly.py from yum-plugin-downloadonly which is a yum-utils package.

Comment 23 errata-xmlrpc 2015-07-22 07:21:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1384.html


Note You need to log in before you can comment on or make changes to this bug.