Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 863997

Summary: yum check-update with rhnplugin doesn't set correct exit code on error
Product: [Community] Spacewalk Reporter: Milan Zázrivec <mzazrivec>
Component: ClientsAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: medium    
Version: 1.8CC: jhutar, pmutha
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 802636 Environment:
Last Closed: 2012-11-01 16:17:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 871344    

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 (Red Hat) 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 (Red Hat) 2012-11-01 16:17:36 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18