def find_cert_file()

in aws-iot-greengrass-for-beginners/alert/main.py [0:0]


def find_cert_file(cert_prefix):
    """
    Find the certificates file from ./certs directory

    Parameters
    ----------
    cert_prefix: AmazonRootCA1.pem, cert.pem, private.key

    Returns
    ----------
    file_path: String

    """

    for _, _, names in os.walk(CERT_ROOT):
        for file in names:
            if cert_prefix in file:
                return CERT_ROOT + "/" + file

    raise Exception("%s not found." % cert_prefix)