Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
def teardown():
    '''
    announce the end of the test run
    '''
    # also clean up SSH keys left by rhui
    ConMgr.remove_ssh_keys(RHUA, CDS_HOSTNAMES)
    print("*** Finished running %s. *** " % basename(__file__))
Ejemplo n.º 3
0
def test_20_delete_unreachable():
    '''
    add a Load-balancer, make it unreachable, and see if it can still be deleted from the RHUA
    '''
    # for RHBZ#1639996
    status = RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME, unsafe=True)
    nose.tools.ok_(status, msg="unexpected installation status: %s" % status)
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [HA_HOSTNAME])

    Helpers.break_hostname(RHUA, HA_HOSTNAME)

    # delete it
    status = RHUICLI.delete(RHUA, "haproxy", [HA_HOSTNAME], force=True)
    nose.tools.ok_(status, msg="unexpected deletion status: %s" % status)
    # check it
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [])

    Helpers.unbreak_hostname(RHUA)

    # the node remains configured (haproxy)... unconfigure it properly
    # do so by adding and deleting it again
    RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME, unsafe=True)
    RHUICLI.delete(RHUA, "haproxy", [HA_HOSTNAME], force=True)

    # clean up the SSH key
    ConMgr.remove_ssh_keys(RHUA, [HA_HOSTNAME])
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
def test_18_add_safe_unknown_key():
    '''
    try adding the Load-balancer when its SSH key is unknown, without using --unsafe; should fail
    '''
    # for RHBZ#1409460
    # make sure its key is unknown
    ConMgr.remove_ssh_keys(RHUA, [HA_HOSTNAME])
    # try adding the Load-balancer
    status = RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME)
    nose.tools.ok_(not status, msg="unexpected addition status: %s" % status)
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [])
Ejemplo n.º 6
0
def test_18_add_safe_unknown_key():
    '''
    try adding a CDS whose SSH key is unknown, without using --unsafe; should fail
    '''
    # for RHBZ#1409460
    # choose a random CDS hostname from the list
    cds = random.choice(CDS_HOSTNAMES)
    # make sure its key is unknown
    ConMgr.remove_ssh_keys(RHUA, [cds])
    # try adding the CDS
    status = RHUICLI.add(RHUA, "cds", cds)
    nose.tools.ok_(not status,
                   msg="unexpected %s addition status: %s" % (cds, status))
    cds_list = RHUICLI.list(RHUA, "cds")
    nose.tools.eq_(cds_list, [])
Ejemplo n.º 7
0
def test_19_add_safe_known_key():
    '''
    add and delete the Load-balancer when its SSH key is known, without using --unsafe; should work
    '''
    # for RHBZ#1409460
    # accept the host's SSH key
    ConMgr.add_ssh_keys(RHUA, [HA_HOSTNAME])
    # actually add and delete the host
    status = RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME)
    nose.tools.ok_(status, msg="unexpected addition status: %s" % status)
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [HA_HOSTNAME])
    status = RHUICLI.delete(RHUA, "haproxy", [HA_HOSTNAME], force=True)
    nose.tools.ok_(status, msg="unexpected deletion status: %s" % status)
    # clean up the SSH key
    ConMgr.remove_ssh_keys(RHUA, [HA_HOSTNAME])
Ejemplo n.º 8
0
def test_19_add_safe_known_key():
    '''
    add and delete a CDS whose SSH key is known, without using --unsafe; should work
    '''
    # for RHBZ#1409460
    # choose a random CDS hostname from the list
    cds = random.choice(CDS_HOSTNAMES)
    # accept the host's SSH key
    ConMgr.add_ssh_keys(RHUA, [cds])
    # actually add and delete the host
    status = RHUICLI.add(RHUA, "cds", cds)
    nose.tools.ok_(status,
                   msg="unexpected %s addition status: %s" % (cds, status))
    cds_list = RHUICLI.list(RHUA, "cds")
    nose.tools.eq_(cds_list, [cds])
    status = RHUICLI.delete(RHUA, "cds", [cds], force=True)
    nose.tools.ok_(status,
                   msg="unexpected %s deletion status: %s" % (cds, status))
    # clean up the SSH key
    ConMgr.remove_ssh_keys(RHUA, [cds])
Ejemplo n.º 9
0
def test_99_cleanup():
    """delete the HAProxy Load-balancer"""
    RHUIManagerInstance.delete(RHUA, "loadbalancers", [HA_HOSTNAME])
    # also clean up the SSH keys (if left behind)
    ConMgr.remove_ssh_keys(RHUA)