def remove_subscription_manager(): loggerinst.info("Removing RHEL subscription-manager packages.") # python3-subscription-manager-rhsm, dnf-plugin-subscription-manager, subscription-manager-rhsm-certificates, etc. submgr_pkgs = pkghandler.get_installed_pkgs_by_fingerprint(system_info.fingerprints_rhel, "*subscription-manager*") if not submgr_pkgs: loggerinst.info("No packages related to subscription-manager installed.") return pkghandler.call_yum_cmd("remove", " ".join(submgr_pkgs), print_output=False)
def match_repo_pkgs_to_installed(rhel_repos_content): """Determine in which RHEL repositories the installed packages are available and report which packages are not available in any RHEL repo. Return list of the needed RHEL repositories. """ installed_pkgs = pkghandler.get_installed_pkgs_by_fingerprint( system_info.fingerprints_orig_os) pkgs = determine_pkg_availability(rhel_repos_content, installed_pkgs) warn_about_nonavail_pkgs(pkgs) supported_repos = get_supported_repos() repos_needed = get_repos_needed(pkgs["moved"].keys(), supported_repos) return repos_needed
def test_get_installed_pkgs_by_fingerprint_incorrect_fingerprint(self): pkgs_by_fingerprint = pkghandler.get_installed_pkgs_by_fingerprint( "non-existing fingerprint") self.assertEqual(pkgs_by_fingerprint, [])
def test_get_installed_pkgs_by_fingerprint_correct_fingerprint(self): pkgs_by_fingerprint = pkghandler.get_installed_pkgs_by_fingerprint( "199e2f91fd431d51") self.assertEqual(pkgs_by_fingerprint, ["pkg1", "gpg-pubkey"])