def obtain_cert_node_info(name):
    cert_conffile = _conf.get("security", "certificate_conf")
    domain = _conf.get("security", "certificate_domain")
    if domain is None or name is None:
        # No security or name specified just use standard node UUID
        _log.debug("OBTAINING no security domain={}, name={}".format(domain, name))
        return {'domain': None, 'name': name, 'id': calvinuuid.uuid("NODE")}

    cert_conf = Config(cert_conffile, domain)
    name_dir = os.path.join(cert_conf.configuration["CA_default"]["runtimes_dir"], name)
    # Does existing signed runtime certificate exist, return info
    try:
        filenames = os.listdir(os.path.join(name_dir, "mine"))
        content = open(os.path.join(name_dir, "mine", filenames[0]), 'rt').read()
        cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
                                              content)
        subject = cert.get_subject()
        if subject.commonName != name or subject.organizationName != domain:
            raise
        _log.debug("OBTAINING existing security domain={}, name={}".format(domain, name))
        return {'domain': domain, 'name': name, 'id': subject.dnQualifier}
    except:
        pass
        #_log.exception("OBTAINING fail existing security domain={}, name={}".format(domain, name))

    # Create new CSR
    csrfile = new_runtime(cert_conf, name, nodeid=calvinuuid.uuid("NODE"))
    _log.debug("OBTAINING new security csr={}, domain={}, name={}".format(csrfile, domain, name))
    try:
        content = open(csrfile, 'rt').read()
        cert = OpenSSL.crypto.load_certificate_request(OpenSSL.crypto.FILETYPE_PEM,
                                                      content)
        subject = cert.get_subject()
        # TODO multicast signing of CSR, now just sign it assuming local CA
        sign_req(cert_conf, os.path.basename(csrfile), name)
        _log.debug("OBTAINING new security domain={}, name={}".format(domain, name))
        return {'domain': domain, 'name': name, 'id': subject.dnQualifier}
    except:
        #_log.exception("OBTAINING fail new security domain={}, name={}".format(domain, name))
        return {'domain': None, 'name': name, 'id': calvinuuid.uuid("NODE")}
Destroys the test datastore files.
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/utilities/certificate.py/obtain_cert_node_info--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/appengine_django/db/creation.py/DatabaseCreation.destroy_test_db