--- redhat_upgrade_tool/download.py.orig 2023-12-18 12:27:36.000000000 +0200 +++ redhat_upgrade_tool/download.py 2023-12-20 09:12:06.435879445 +0200 @@ -30,7 +30,6 @@ from yum.constants import TS_REMOVE_STAT from urlgrabber.grabber import URLGrabError from yum.misc import gpgme from gzip import GzipFile -from rhsm.certificate import create_from_pem enabled_plugins = ['blacklist', 'whiteout'] disabled_plugins = ['rpm-warm-cache', 'remove-with-leaves', 'presto', @@ -339,47 +338,6 @@ class UpgradeDownloader(yum.YumBase): if updates: self._checkSignatures(updates, callback) - # store RHSM productid certificates - # (this code is inspired by is taken from subscription_manager.productid) - used_repos = set([p.repoid for p in updates]) - for repo in self.repos.listEnabled(): - # skip repos we have not used to download any package - if repo.id not in used_repos: - continue - - # skip repos we don't have productid for - try: - fn = repo.retrieveMD('productid') - if fn.endswith('.gz'): - f = GzipFile(fn) - else: - f = open(fn) - try: - pem = f.read() - cert = create_from_pem(pem) - finally: - f.close() - except yum.Errors.RepoMDError, e: - log.warn("Error loading productid metadata for %s." % repo) - continue - except Exception, e: - log.warn("Error loading productid metadata for %s." % repo) - log.exception(e) - continue - if cert is None: - continue - - product = cert.products[0] - - log.debug("product cert: %s repo: %s" % (product.id, repo.id)) - - # temporarily use different directory for storing certificates - packagedir = '/root/preupgrade/productid' - mkdir_p(packagedir) - path = os.path.join(packagedir, '%s.pem' % product.id) - cert.write(path) - log.info("Downloaded product cert %s: %s %s" % (product.id, product.name, cert.path)) - def clean_cache(self, keepfiles): log.info("checking for unneeded rpms in cache") # Find all the packages in the caches (not on media though)