Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionMartin Osvald 🛹
2011-03-24 19:33:29 UTC
Created attachment 487415[details]
temporary patch which fixes the problem
Description of problem:
If you want to rollback to a previous version of some package and that package is no longer in any of enabled/available repositories, yum instead of keeping the current package as it is removes the package.
Version-Release number of selected component (if applicable):
yum-rhn-plugin-0.5.4-17.el5
How reproducible:
Always
Steps to Reproduce:
1. Create a local repository and put there two versions of the same package and install it:
$ mkdir /tmp/myrepo
$ cp some_pkg-1.0.rpm some_pkg-1.1.rpm /tmp/myrepo
$ createrepo /tmp/myrepo
$ cat > /etc/yum.repos.d/my.repo <<ENDTAG
[myrepo]
name=myrepo
baseurl=file:///tmp/myrepo
enabled=1
gpgcheck=0
ENDTAG
$ yum install some_pkg-1.0.rpm -y && yum install some_pkg-1.1.rpm -y
2. Remove older package and rebuild the repository:
$ rm /tmp/myrepo/some_pkg-1.0.rpm
$ createrepo /tmp/myrepo
3. Rollback to previous snapshot through WebUI which contains some_pkg-1.0.rpm
Systems -> Systems -> [some profile] -> Provisioning -> Snapshots -> [snapshot] -> 'Rollback to Snapshot'
4. Run rhn_check on client
$ rhn_check
Actual results:
[root@localhost ~]# rpm -qa nxclient
nxclient-3.4.0-7
[root@localhost ~]# rhn_check
[root@localhost ~]# rpm -qa nxclient
[root@localhost ~]#
Expected results:
If yum cannot find older/snapshot package, it should leave the newer/current one as it is and return an error instead.
[root@localhost ~]# rpm -qa nxclient
nxclient-3.4.0-7
[root@localhost ~]# rhn_check
[root@localhost ~]# rpm -qa nxclient
nxclient-3.4.0-7
[root@localhost ~]#
Additional info:
The problem is caused by a missing condition which would check for presence of snapshot package in enabled repositories. The attached temporary patch fixes the problem - it returns an error back to Satellite about missing package required for rollback instead of only performing un-installation action.
The following is output from debugger which shows that package list is empty (because of the missing package in repo), which skips the package addition/installation and finally leads to system without any package:
> /usr/share/rhn/actions/packages.py(249)add_transaction_data()
-> for po in pkgs:
(Pdb) list
244 # we are doing rollback, we want exact version
245 # no dependecy check
246 pkgs = self.pkgSack.searchNevra(name=pkgkeys['name'],
247 epoch=pkgkeys['epoch'], arch=pkgkeys['arch'],
248 ver=pkgkeys['version'], rel=pkgkeys['release'])
249 -> for po in pkgs:
250 self.tsInfo.addInstall(po)
(Pdb) p pkgs
[]
(Pdb)
related code:
yum-rhn-plugin-svn-r197503/actions/packages.py:
210 def add_transaction_data(self, transaction_data):
211 """ Add packages to transaction.
212 transaction_data is in format:
213 { 'packages' : [
214 [['name', '1.0.0', '1', '', ''], 'e'], ...
215 # name, versio, rel., epoch, arch, flag
216 ]}
217 where flag can be:
218 i - install
219 u - update
220 e - remove
221 r - rollback
222 Note: install and update will check for dependecies and
223 obsoletes and will install them if needed.
224 Rollback do not check anything and will assume that state
225 to which we are rolling back should be correct.
226 """
227 for pkgtup, action in transaction_data['packages']:
...
243 elif action == 'r':
244 # we are doing rollback, we want exact version
245 # no dependecy check
246 pkgs = self.pkgSack.searchNevra(name=pkgkeys['name'],
247 epoch=pkgkeys['epoch'], arch=pkgkeys['arch'],
248 ver=pkgkeys['version'], rel=pkgkeys['release'])
249 for po in pkgs:
250 self.tsInfo.addInstall(po)