def test_99_cleanup(self): """clean up""" # remove the configuration RPM from the client Util.remove_rpm(CLI, [self.repo_with_mod_groups]) # remove comps info from MongoDB units = ["category", "environment", "group", "langpacks"] base_mongo_cmd = "db.units_package_%s.remove({})" all_mongo_cmds = [base_mongo_cmd % unit for unit in units] shell_cmd = "mongo pulp_database --eval '%s'" % "; ".join( all_mongo_cmds) Expect.expect_retval(RHUA, shell_cmd) # remove repos for repo in self.test_repos: RHUIManagerCLI.repo_delete(RHUA, repo) Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % repo) RHUIManagerCLI.repo_delete(RHUA, BIG_REPO) RHUIManagerCLI.repo_delete(RHUA, ZIP_REPO) # uninstall HAProxy & CDS, forget their keys if not getenv("RHUISKIPSETUP"): RHUICLI.delete(RHUA, "haproxy", force=True) RHUICLI.delete(RHUA, "cds", force=True) ConMgr.remove_ssh_keys(RHUA) # if running RHEL Beta, destroy the non-Beta repos again cmd = "if grep -c Beta /etc/redhat-release; then " \ "rm -f /etc/yum.repos.d/redhat-rhui.repo; fi" Expect.expect_retval(RHUA, cmd)
def test_08_install_conf_rpm(self): """replace the 1st client configuration RPM with the 2nd one on the client""" # get rid of the first one before installing the second one Util.remove_rpm(CLI, [self.test_repos[0]]) Util.install_pkg_from_rhua(RHUA, CLI, "/tmp/%s-2.0/build/RPMS/noarch/%s-2.0-1.noarch.rpm" % \ (self.test_repos[1], self.test_repos[1]))
def test_99_cleanup(self): '''clean up''' Expect.expect_retval(CLI, "rhui-set-release --unset") Util.remove_rpm(CLI, [self.test_package, CONF_RPM_NAME]) RHUIManagerCLI.repo_delete(RHUA, self.repo_id) Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % CONF_RPM_NAME) if not getenv("RHUISKIPSETUP"): RHUIManager.remove_rh_certs(RHUA) RHUICLI.delete(RHUA, "haproxy", force=True) RHUICLI.delete(RHUA, "cds", force=True) ConMgr.remove_ssh_keys(RHUA)
def test_99_cleanup(self): ''' remove the repo, uninstall hap, cds, cli rpm artefacts; remove rpms from cli ''' Util.remove_rpm(CLI, [self.test["test_package"], self.test["repo_id"]]) # the errata must be removed in the DB directly: Expect.expect_retval( RHUA, "mongo pulp_database --eval 'db.units_erratum.remove({})'") RHUIManagerRepo.delete_all_repos(RHUA) Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % self.test["repo_id"]) if not getenv("RHUISKIPSETUP"): RHUIManagerInstance.delete_all(RHUA, "loadbalancers") RHUIManagerInstance.delete_all(RHUA, "cds")
def test_99_cleanup(): ''' clean up ''' Util.remove_rpm(CLI, [SIGNED_PACKAGE, "gpg-pubkey-%s" % SIG, REPO]) rhel = Util.get_rhel_version(CLI)["major"] if rhel <= 7: cache = "/var/cache/yum/x86_64/%sServer/rhui-custom-%s/" % (rhel, REPO) else: cache = "/var/cache/dnf/rhui-custom-%s*/" % REPO Expect.expect_retval(CLI, "rm -rf %s" % cache) RHUIManagerRepo.delete_all_repos(RHUA) Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % REPO) if not getenv("RHUISKIPSETUP"): RHUIManagerInstance.delete_all(RHUA, "loadbalancers") RHUIManagerInstance.delete_all(RHUA, "cds")
def test_99_cleanup(self): ''' remove repos, certs, cli rpms; remove rpms from cli, uninstall cds, hap ''' test_rpm_name = self.custom_rpm.rsplit('-', 2)[0] RHUIManagerRepo.delete_all_repos(RHUA) nose.tools.assert_equal(RHUIManagerRepo.list(RHUA), []) Expect.expect_retval(RHUA, "rm -f /root/test_ent_cli*") Expect.expect_retval(RHUA, "rm -rf /root/test_cli_rpm-3.0/") Util.remove_rpm(CLI, [self.test_package, "test_cli_rpm", test_rpm_name]) rmtree(TMPDIR) Helpers.del_legacy_ca(CDS, LEGACY_CA_FILE) if not getenv("RHUISKIPSETUP"): RHUIManagerInstance.delete_all(RHUA, "loadbalancers") RHUIManagerInstance.delete_all(RHUA, "cds") RHUIManager.remove_rh_certs(RHUA)
def test_99_cleanup(self): ''' remove the containers from the client and the RHUA, uninstall HAProxy and CDS ''' if self.cli_supported: Expect.expect_retval(CLI, "docker rm -f $(docker ps -a -f ancestor=%s -q)" % \ self.container_id) for container in [ self.container_id, Util.safe_pulp_repo_name(self.container_quay["name"]), Util.safe_pulp_repo_name(self.container_docker["name"]) ]: Expect.expect_retval(CLI, "docker rmi %s" % container) Util.remove_rpm(CLI, [CONF_RPM_NAME]) Util.restart_if_present(CLI, "docker") Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % CONF_RPM_NAME) RHUIManagerRepo.delete_all_repos(RHUA) if not getenv("RHUISKIPSETUP"): RHUIManagerInstance.delete_all(RHUA, "loadbalancers") RHUIManagerInstance.delete_all(RHUA, "cds")
def test_12_additional_group(self): """import a comps file containing one more group and expect the group to be added""" # and nothing lost... # import the "updated" comps file repo = self.repo_with_mod_groups modified_comps_xml = "/tmp/extra_rhui_files/%s/mod-comps.xml" % repo RHUIManagerCLI.repo_add_comps(RHUA, repo, modified_comps_xml) # create a client configuration RPM, install it on the client RHUIManagerCLI.client_rpm(RHUA, [repo], [repo, "2.1"], "/tmp") Util.remove_rpm(CLI, [self.test_repos[1]]) Util.install_pkg_from_rhua(RHUA, CLI, "/tmp/%s-2.1/build/RPMS/noarch/%s-2.1-1.noarch.rpm" % \ (repo, repo)) # compare client's available groups with the *original* comps file, # expecting all the original groups plus the extra group groups_on_client = Yummy.yum_grouplist(CLI) original_comps_xml = "/tmp/extra_rhui_files/%s/comps.xml" % repo groups_in_xml = Yummy.comps_xml_grouplist(RHUA, original_comps_xml) # trick: put the extra group to the right place in the sorted list insort(groups_in_xml, self.test_group_mod) nose.tools.eq_(groups_on_client, groups_in_xml) nose.tools.ok_(self.test_group_mod in groups_on_client)
def test_99_cleanup(self): ''' remove created repos, entitlements and custom cli rpms, remove rpms from cli, uninstall cds, hap, delete the RH cert ''' RHUIManager.initial_run(connection) RHUIManagerRepo.delete_all_repos(connection) nose.tools.assert_equal(RHUIManagerRepo.list(connection), []) RHUIManagerInstance.delete(connection, "loadbalancers", ["hap01.example.com"]) RHUIManagerInstance.delete(connection, "cds", ["cds01.example.com"]) Expect.expect_retval(connection, "rm -f /root/test_ent_cli*") Expect.expect_retval(connection, "rm -rf /root/test_cli_rpm-3.0/") Expect.expect_retval(connection, "rm -rf /root/test_docker_cli_rpm-4.0/") if self.rhua_os_version >= 7: Util.remove_rpm(cli, ["vm-dump-metrics", "test_docker_cli_rpm"]) else: Util.remove_rpm(cli, ["js"]) Util.remove_rpm(cli, ["test_cli_rpm", "rhui-rpm-upload-test"]) RHUIManager.remove_rh_certs(connection)