Hide Forgot
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)
Commited to Spacewalk.git as 32b633cda7cbeedc120478f2681255fdeb6e0200
Did not get response before devel freeze. Closing for now. If you will disagree, do not hesitate to reopen it and provide requested information.