@classmethod
    def initialize(cls, path, authority, begin=None, uuid=None):
        if uuid is None:
            uuid = bytes(uuid4())
        key_filename = b"{uuid}.key".format(uuid=uuid)
        cert_filename = b"{uuid}.crt".format(uuid=uuid)
        # The common name for the node certificate.
        name = b"{prefix}{uuid}".format(prefix=cls._UUID_PREFIX, uuid=uuid)
        # The organizational unit is set to the organizational unit of the
        # authority, which in our case is cluster's UUID.
        organizational_unit = authority.organizational_unit
        dn = DistinguishedName(
            commonName=name, organizationalUnitName=organizational_unit
        )
        keypair = flocker_keypair()
        request = keypair.keypair.requestObject(dn)
        serial = os.urandom(16).encode(b"hex")
        serial = int(serial, 16)
        cert = sign_certificate_request(
            authority.credential.keypair.keypair,
            authority.credential.certificate.original.get_subject(), request,
            serial, EXPIRY_20_YEARS, 'sha256', start=begin)
        credential = FlockerCredential(
            path=path, keypair=keypair, certificate=cert)
        credential.write_credential_files(
            key_filename, cert_filename)
        instance = cls(credential=credential)
        return instance
Generate a certificate signed by the supplied root certificate.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/ca/_ca.py/NodeCredential.initialize