Beispiel #1
0
def getCerts(facts_dict, product_certs):

    rhic = RhicCertificate.read()

    try:
        identifier = managerlib.getRhicMachineId(facts_dict)
        log.info("machine identifier is %s" % identifier)
    except:
        log.error("unable to determine machine identifier, aborting")
        raise

    results = None

    # grab the certs from RCS
    for i in range(LOOKUP_MAX_ATTEMPTS):
        try:
            results = SpliceConnection().getCerts(rhic, identifier, installed_products=product_certs, facts_dict=facts_dict)
        except AcceptedException:
            log.info("got a 202, retrying after pause of %s seconds" % LOOKUP_RETRY_DELAY)
            time.sleep(LOOKUP_RETRY_DELAY)
        else:
            break

    return results
 def test_rhic_id_gen(self):
     self.assertTrue(getRhicMachineId(self.physical_facts), 'FOOphyiscal-hw:ad:d:re:ss')
     self.assertTrue(getRhicMachineId(self.virt_facts), 'FOOvirt-hw:ad:d:re:ss')
     self.assertTrue(getRhicMachineId(self.only_mac_facts), '-hw:ad:d:re:ss')
     self.assertTrue(getRhicMachineId(self.only_uuid_facts), 'FOO')
     self.assertRaises(Exception, getRhicMachineId, {})