Description of problem: When upgrading a satellite < 4.2 to 4.2 or later if there are errata associated with channels with no associated packages and these channels are subsequently applied to RHEL5 machines those machines will then fail all further updates until packages are applied to the errata or the channel is disassociated with the machine. Steps to Reproduce: 1. on pre 4.2 sat create errata associated with non-RHEL channel without packages 2. upgrade to 4.2 or later 3. associate a rhel5 machine with the channel and attempt to update. Actual results: Exception Handler Information Traceback (most recent call last): File "/usr/share/rhn/server/apacheRequest.py", line 108, in call_function response = apply(func, params) File "/usr/share/rhn/server/rhnRepository.py", line 169, in repodata output = repo.get_repomd_file() File "/usr/share/rhn/server/repomd/repository.py", line 299, in get_repomd_file self.repository.get_updateinfo_xml_file(), File "/usr/share/rhn/server/repomd/repository.py", line 90, in get_updateinfo_xml_file viewobj.write_updateinfo() File "/usr/share/rhn/server/repomd/view.py", line 287, in write_updateinfo for erratum in self.channel.errata: File "/usr/share/rhn/server/repomd/mapper.py", line 102, in _erratum_generator erratum = self.erratum_mapper.get_erratum(erratum_id[0]) File "/usr/share/rhn/server/repomd/mapper.py", line 423, in get_erratum package = self.package_mapper.get_package(package_id) File "/usr/share/rhn/server/repomd/mapper.py", line 129, in get_package last_modified = str(self.mapper.last_modified(package_id)) File "/usr/share/rhn/server/repomd/mapper.py", line 268, in last_modified return self.last_modified_sql.fetchone()[0] TypeError: unsubscriptable object Expected results: no error. Additional info:
Created attachment 161869 [details] sql to diagnose empty errata
SQL from attachment is: select id,advisory,advisory_name from rhnErrata re where (select count(*) from rhnErrataPackage rep where rep.errata_id = re.id) = 0; I am not sure when/where I could add this type of check in the upgrade process. But it is worth looking at for Sat 5.1 upgrades. There is no IT with this, so I am wondering if you can hit this with pre-upgraded systems and current code base, once upgraded, prevents this issue from occuring. Cliff.
(In reply to comment #3) > Flags are all set but status is still NEW. Has this been fixed yet ? No. It is in my queue.
I've took freshly baked 5.1.0 Satellite (no upgrade), created custom channel, put packages into it, put erratas into it, then deleted those packages. The select from comment 2 returns some records for me, and repomd data get generated without problem. So it looks like this select does not describe the situation when the repomd generation would fail. Of course, the 5.1.0 code might have changed from 4.2 so what used to fail on 4.2 does not fail on 5.1.0 anymore.
Hmmm, but those erratas still have those packages in the channel I've cloned them from ... So this was not a good test.
The problem is not updates-related. I was able to reproduce it solely on Satellite 5.1.0. The problem lies in the fact that if a package is deleted from the system, the errata cache record (like /var/cache/rhn/repomd-errata/1194) never gets updated. When the code of File "/usr/share/rhn/server/repomd/mapper.py", line 423, in get_erratum package = self.package_mapper.get_package(package_id) is executed within this method def get_erratum(self, erratum_id): """ Load the erratum with id erratum_id. Load from the cache, if it is new enough. If not, fall back to the provided mapper. """ erratum_id = str(erratum_id) last_modified = str(self.mapper.last_modified(erratum_id)) last_modified = re.sub(" ", "", last_modified) last_modified = re.sub(":", "", last_modified) last_modified = re.sub("-", "", last_modified) cache_key = "repomd-errata/" + erratum_id if self.cache.has_key(cache_key, last_modified): erratum = self.cache.get(cache_key) for package_id in erratum.package_ids: package = self.package_mapper.get_package(package_id) erratum.packages.append(package) else: erratum = self.mapper.get_erratum(erratum_id) tmp_packages = erratum.packages erratum.packages = [] self.cache.set(cache_key, erratum, last_modified) erratum.packages = tmp_packages return erratum it fetches the erratum.package_ids from the cache and then tries to fetch the package from the database. And since the package is no longer in the database, it fails.
Created attachment 291294 [details] Traceback from Satellite 5.1.0 This is an up-to-date traceback from the latest Satellite.
Sending schema/rhnsat/tables/rhnErrataPackage_triggers.sql Transmitting file data . Committed revision 135606. Sending schema/satellite-upgrade/satellite-5.0-to-5.1.sql Transmitting file data . Committed revision 135607.
For the situation originally reported and reflected in the summary of this bugzilla, namely that tracebacks start to appear after upgrade of the Satellite, I strongly suspect that the OP did not run rm -fr /var/cache/rhn/* as suggested by /etc/sysconfig/rhn/satellite-upgrade/README.
With Satellite ISO 5.1.0-47 available, and more importantly, with http://barn.rhndev.redhat.com/repo/repository/rhn-upgrade/rhn-upgrade-5.1.0-5.noarch.rpm available, moving ON_QA.
Satellite 5.1.0 Upgrades (sat/proxy) for 5.1 Sat GA so Closed for Current Release.