yum check-update with rhnplugin doesn't return correct exit code on error.

Solution Verified - Updated -

Issue

  • According to man page of "yum" exit code "0" means no packages are available for update and exit code "1" means an error occurred.
# 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            <---
  • Reference manpage of yum command.
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.

Environment

  • Red Hat Enterprise Linux 6.2

    • yum-rhn-plugin-0.9.1-36
  • Red Hat Enterprise Linux 5.9

    • yum-rhn-plugin-0.5.4-29.el5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content