Bug 428757

Summary: document yum exit codes
Product: Red Hat Enterprise Linux 5 Reporter: Jan Hutař <jhutar>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 5.1   
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-03-25 02:15:54 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Jan Hutař 2008-01-14 18:21:50 EST
Description of problem:
Please document yum exit values. The only note in a `man yum` is about check-
updates 100/0. 

I'm asking because I just noted, then when I tried to upgrade while one of the 
packages have broken deps I got $? == 1. Usually yum returns 0, or 1 if it 
tracebacks.


Version-Release number of selected component (if applicable):
yum-3.0.1-5.el5.noarch


Additional info:
  Make yum more "hackable" with exit codes and/or standardize
  the output to make it easier for shell scripts and one liners
  to interact with
  
  No. Just no. If you don't like it, go have a conversation
  with yourself about it. Alone. At home. In your closet. 
  
  Why not?
  ...
  --http://wiki.linux.duke.edu/YumTodont#head-
dbc33b4a2fa91306796798e6f9119d235172e1aa
Comment 1 Jan Hutař 2008-01-16 10:19:25 EST
Just run into another issue - while yum did what I wanted, it ended with 1:

# yum -y install --disablerepo=repo011 --disablerepo=repo022 --downloadonly 
test --downloaddir=.
...
Downloading Packages:
(1/1): test-0.1-1.i386.rp 100% |=========================| 2.2 kB    00:00
# echo $?
1
Comment 2 Jan Hutař 2008-01-16 10:22:55 EST
Bad copy&paste:

# yum -y install --disablerepo=repo011 --disablerepo=repo022 --downloadonly 
test --downloaddir=.
...
Downloading Packages:
(1/1): test-0.1-1.i386.rp 100% |=========================| 2.2 kB    00:00


exiting because --downloadonly specified
# echo $?
1

And there is this code in /usr/lib/yum-plugins/downloadonly.py:

def postdownload_hook(conduit):
    opts, commands = conduit.getCmdLine()
    if opts.dlonly:
        raise PluginYumExit('exiting because --downloadonly specified ')
Comment 3 James Antill 2008-01-16 10:52:12 EST
 Right, that's how yum-downloadonly works ... it pretends something bad
happened. In theory it could probably call sys.exit(), but this way guarantees
any cleanup needed is done.