Skip to content

Instantly share code, notes, and snippets.

@void-elf
Created April 27, 2017 21:51
Show Gist options
  • Select an option

  • Save void-elf/f83e310c0ef5adba8a6da5eeca3b6f96 to your computer and use it in GitHub Desktop.

Select an option

Save void-elf/f83e310c0ef5adba8a6da5eeca3b6f96 to your computer and use it in GitHub Desktop.
def cert_path_to_lineage(config):
# If config.cert_path is defined, find an appropriate value for config.certname
# by searching through available files in config.renewal_configs_dir, and finding
# one with an appropriate value for 'fullchain'.
# pylint: disable=unused-argument
def update_cert_name_for_cert_path_match(candidate_lineage, rv):
""" Return the lineagename or return None. """
options = [candidate_lineage.fullchain_path, candidate_lineage.chain_path,
os.path.join(candidate_lineage.archive_dir, os.path.basename(config.cert_path[0]))]
if config.cert_path[0] in options:
return candidate_lineage.lineagename
cert_path_match = _search_lineages(config, update_cert_name_for_cert_path_match, None)
if not cert_path_match:
error_msg = "Could not find a matching lineage for the cert_path {0}"
raise errors.Error(error_msg.format(config.cert_path[0]))
else:
return cert_path_match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment