RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1144503 - yum-plugin-downloadonly exists with error code 1 on success
Summary: yum-plugin-downloadonly exists with error code 1 on success
Keywords:
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:
Depends On:
Blocks: 1075802 1159926
TreeView+ depends on / blocked
 
Reported: 2014-09-19 14:56 UTC by Felix Dewaleyne
Modified: 2019-07-11 08:12 UTC (History)
7 users (show)

Fixed In Version: yum-3.2.29-69.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-22 07:21:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


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

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.