mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
Add _choose_lineagename and update docs (#5650)
This commit is contained in:
+25
-10
@@ -338,9 +338,10 @@ class Client(object):
|
|||||||
authenticator and installer, and then create a new renewable lineage
|
authenticator and installer, and then create a new renewable lineage
|
||||||
containing it.
|
containing it.
|
||||||
|
|
||||||
:param list domains: Domains to request.
|
:param domains: domains to request a certificate for
|
||||||
:param plugins: A PluginsFactory object.
|
:type domains: `list` of `str`
|
||||||
:param str certname: Name of new cert
|
:param certname: requested name of lineage
|
||||||
|
:type certname: `str` or `None`
|
||||||
|
|
||||||
:returns: A new :class:`certbot.storage.RenewableCert` instance
|
:returns: A new :class:`certbot.storage.RenewableCert` instance
|
||||||
referred to the enrolled cert lineage, False if the cert could not
|
referred to the enrolled cert lineage, False if the cert could not
|
||||||
@@ -355,13 +356,7 @@ class Client(object):
|
|||||||
"Non-standard path(s), might not work with crontab installed "
|
"Non-standard path(s), might not work with crontab installed "
|
||||||
"by your operating system package manager")
|
"by your operating system package manager")
|
||||||
|
|
||||||
if certname:
|
new_name = self._choose_lineagename(domains, certname)
|
||||||
new_name = certname
|
|
||||||
elif util.is_wildcard_domain(domains[0]):
|
|
||||||
# Don't make files and directories starting with *.
|
|
||||||
new_name = domains[0][2:]
|
|
||||||
else:
|
|
||||||
new_name = domains[0]
|
|
||||||
|
|
||||||
if self.config.dry_run:
|
if self.config.dry_run:
|
||||||
logger.debug("Dry run: Skipping creating new lineage for %s",
|
logger.debug("Dry run: Skipping creating new lineage for %s",
|
||||||
@@ -373,6 +368,26 @@ class Client(object):
|
|||||||
key.pem, chain,
|
key.pem, chain,
|
||||||
self.config)
|
self.config)
|
||||||
|
|
||||||
|
def _choose_lineagename(self, domains, certname):
|
||||||
|
"""Chooses a name for the new lineage.
|
||||||
|
|
||||||
|
:param domains: domains in certificate request
|
||||||
|
:type domains: `list` of `str`
|
||||||
|
:param certname: requested name of lineage
|
||||||
|
:type certname: `str` or `None`
|
||||||
|
|
||||||
|
:returns: lineage name that should be used
|
||||||
|
:rtype: str
|
||||||
|
|
||||||
|
"""
|
||||||
|
if certname:
|
||||||
|
return certname
|
||||||
|
elif util.is_wildcard_domain(domains[0]):
|
||||||
|
# Don't make files and directories starting with *.
|
||||||
|
return domains[0][2:]
|
||||||
|
else:
|
||||||
|
return domains[0]
|
||||||
|
|
||||||
def save_certificate(self, cert_pem, chain_pem,
|
def save_certificate(self, cert_pem, chain_pem,
|
||||||
cert_path, chain_path, fullchain_path):
|
cert_path, chain_path, fullchain_path):
|
||||||
"""Saves the certificate received from the ACME server.
|
"""Saves the certificate received from the ACME server.
|
||||||
|
|||||||
Reference in New Issue
Block a user