Bug 1127782

Summary: yum post transaction action fails when package is removed
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: yum-utilsAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: packaging-team-maint, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: yum-utils-1.1.31-26.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1045494 Environment:
Last Closed: 2015-03-05 09:03:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Srot 2014-08-07 14:35:18 UTC
Present also on RHEL-7.0 with yum-utils-1.1.31-25.el7_0.

+++ This bug was initially created as a clone of Bug #1045494 +++

Description of problem:

Yum post transaction action was delivered to restart litpd service every time new python plugin is delivered and content of directory /opt/ericsson/nms/litp/lib is changed. 

The yum post action file is installed as: /etc/yum/post-actions/litp.action , below is the content of the file:
/opt/ericsson/nms/litp/lib:any:service litpd restart

All works fine during installation but when package is removed I'm getting the following error:

Installed size: 24 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : ERIClitplibvirt_CXP9030547-1.0.44-1.noarch                                                                                                                  1/1 
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 219, in main
    return_code = base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 586, in doTransaction
    resultobject = self.runTransaction(cb=cb)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1590, in runTransaction
    self.plugins.run('posttrans')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/post-transaction-actions.py", line 134, in posttrans_hook
    thispo = _get_installed_po(rpmdb, txmbr.pkgtup)
  File "/usr/lib/yum-plugins/post-transaction-actions.py", line 67, in _get_installed_po
    return rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
IndexError: list index out of range

I'm not sure why do we search for package in rmdb which we just removed.

Version-Release number of selected component (if applicable):

yum-plugin-post-transaction-actions-1.1.31-18.fc20.noarch

How reproducible:

Please try to remove a package for which post transaction action is enabled.

Steps to Reproduce:
1. Enable post-transaction-action for directory which will be changed when some package is removed.
2. Remove package in order to trigger yum-post-transaction-action

Actual results:

You should get "index out of range" exception as package is no longer in rpmdb. The post transaction action won't be executed but package will be removed.

Expected results:

The yum-post-transaction-action should be executed without any exception.

Additional info:

Please contact me for any more info if required.

Comment 6 errata-xmlrpc 2015-03-05 09:03:24 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-0401.html