(cert_ref, **kwargs)
return Cert(**cert_data)
Retrieves the specified cert.

        :param cert_ref: the UUID of the cert to retrieve

        :return: magnum.common.cert_manager.cert_manager.Cert
                 representation of the certificate data
        :raises CertificateStorageException: if certificate retrieval fails
Retrieves the specified cert.
Retrieves the specified cert .
def get_cert(cert_ref, **kwargs):  # noqa: C901
        """Retrieves the specified cert.

        :param cert_ref: the UUID of the cert to retrieve

        :return: magnum.common.cert_manager.cert_manager.Cert
                 representation of the certificate data
        :raises CertificateStorageException: if certificate retrieval fails
        """
        LOG.warning(
            "Loading certificate %s from the local filesystem. "
            "CertManager type 'local' should be used for testing purpose.",
            cert_ref)

        filename_base = os.path.join(CONF.certificates.storage_path, cert_ref)

        filename_certificate = "{0}.crt".format(filename_base)
        filename_private_key = "{0}.key".format(filename_base)
        filename_intermediates = "{0}.int".format(filename_base)
        filename_pkp = "{0}.pass".format(filename_base)

        cert_data = dict()

        try:
            with open(filename_certificate, 'r') as cert_file:
                cert_data['certificate'] = cert_file.read()
        except IOError:
            LOG.error("Failed to read certificate for %s.", cert_ref)
            raise exception.CertificateStorageException(
                msg=_("Certificate could not be read.")
            )
        try:
            with open(filename_private_key, 'r') as key_file:
                cert_data['private_key'] = key_file.read()
        except IOError:
            LOG.error("Failed to read private key for %s.", cert_ref)
            raise exception.CertificateStorageException(
                msg=_("Private Key could not be read.")
            )

        try:
            if path.isfile(filename_intermediates):
                with open(filename_intermediates, 'r') as int_file:
                    cert_data['intermediates'] = int_file.read()
        except IOError as ioe:
            LOG.error("Failed to read certificate.")
            raise exception.CertificateStorageException(msg=str(ioe))

        try:
            if path.isfile(filename_pkp):
                with open(filename_pkp, 'r') as pass_file:
                    cert_data['private_key_passphrase'] = pass_file.read()
        except IOError as ioe:
            LOG.error("Failed to read certificate.")
            raise exception.CertificateStorageException(msg=str(ioe))

        return Cert(**cert_data)
def get_cert ( cert_ref , * * kwargs ) : # noqa: C901 LOG . warning ( "Loading certificate %s from the local filesystem. " "CertManager type 'local' should be used for testing purpose." , cert_ref ) filename_base = os . path . join ( CONF . certificates . storage_path , cert_ref ) filename_certificate = "{0}.crt" . format ( filename_base ) filename_private_key = "{0}.key" . format ( filename_base ) filename_intermediates = "{0}.int" . format ( filename_base ) filename_pkp = "{0}.pass" . format ( filename_base ) cert_data = dict ( ) try : with open ( filename_certificate , 'r' ) as cert_file : cert_data [ 'certificate' ] = cert_file . read ( ) except IOError : LOG . error ( "Failed to read certificate for %s." , cert_ref ) raise exception . CertificateStorageException ( msg = _ ( "Certificate could not be read." ) ) try : with open ( filename_private_key , 'r' ) as key_file : cert_data [ 'private_key' ] = key_file . read ( ) except IOError : LOG . error ( "Failed to read private key for %s." , cert_ref ) raise exception . CertificateStorageException ( msg = _ ( "Private Key could not be read." ) ) try : if path . isfile ( filename_intermediates ) : with open ( filename_intermediates , 'r' ) as int_file : cert_data [ 'intermediates' ] = int_file . read ( ) except IOError as ioe : LOG . error ( "Failed to read certificate." ) raise exception . CertificateStorageException ( msg = str ( ioe ) ) try : if path . isfile ( filename_pkp ) : with open ( filename_pkp , 'r' ) as pass_file : cert_data [ 'private_key_passphrase' ] = pass_file . read ( ) except IOError as ioe : LOG . error ( "Failed to read certificate." ) raise exception . CertificateStorageException ( msg = str ( ioe ) ) return Cert ( * * cert_data )