Bug 863997 - yum check-update with rhnplugin doesn't set correct exit code on error
Summary: yum check-update with rhnplugin doesn't set correct exit code on error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Clients
Version: 1.8
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space18
TreeView+ depends on / blocked
 
Reported: 2012-10-08 09:47 UTC by Milan Zázrivec
Modified: 2018-11-30 22:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 802636
Environment:
Last Closed: 2012-11-01 16:17:36 UTC
Embargoed:


Attachments (Terms of Use)

Description Milan Zázrivec 2012-10-08 09:47:29 UTC
+++ This bug was initially created as a clone of Bug #802636 +++

Description of problem:

The yum man page says the following:
"   check-update
Implemented  so  you  could know if your machine had any updates that needed to be applied without running it interactively. Returns exit value of 100 if there are packages available for an update. Also returns a list of the packages to  be  updated in  list format. Returns 0 if no packages are available for update. Returns 1 if an error occurred.  Running in verbose mode
also shows obsoletes."

However when system is not able to reach rhn/satellite it returns 0 instead of 1 :

----------
# yum check-update
Loaded plugins: product-id, rhnplugin, subscription-manager
Updating certificate-based repositories.
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.
Error communicating with server. The message was:
Connection refused

# echo $?
0
----------

It should have returned 1 instead of 0

Version-Release number of selected component (if applicable):
yum-rhn-plugin-0.9.1-36.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1.Edit /etc/sysconfig/rhn/update file and alter the rhn/satellite FQDN under  serverURL in such a way that system is unable to reach it or unable to resolve the FQDN
2.Execute :
yum check-update
3. Once it fails then execute :
echo $?
  
Actual results:
0

Expected results:
1

Additional info:
N/A

Comment 1 Milan Zázrivec 2012-10-08 09:50:08 UTC
spacewalk.git master: bc6db8afd41432b63ecf55835d1e1c0a99591c01

Comment 2 Jan Pazdziora 2012-10-30 19:22:37 UTC
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/

Comment 3 Jan Pazdziora 2012-11-01 16:17:36 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18


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