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])
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])