mirror of
https://github.com/certbot/certbot.git
synced 2026-04-27 17:21:46 -04:00
Make final tweaks for landing #1421
This commit is contained in:
parent
0d01cbfc92
commit
d29ab2a523
3 changed files with 11 additions and 6 deletions
|
|
@ -107,7 +107,7 @@ def _find_domains(args, installer):
|
|||
|
||||
if not domains:
|
||||
raise errors.Error("Please specify --domains, or --installer that "
|
||||
"will help in domain names autodiscovery")
|
||||
"will help in domain names autodiscovery")
|
||||
|
||||
return domains
|
||||
|
||||
|
|
@ -1085,7 +1085,6 @@ def main(cli_args=sys.argv[1:]):
|
|||
# note: arg parser internally handles --help (and exits afterwards)
|
||||
plugins = plugins_disco.PluginsRegistry.find_all()
|
||||
args = prepare_and_parse_args(plugins, cli_args)
|
||||
# Check command line parameters sanity, and error out in case of problem.
|
||||
config = configuration.NamespaceConfig(args)
|
||||
zope.component.provideUtility(config)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class NamespaceConfig(object):
|
|||
|
||||
def __init__(self, namespace):
|
||||
self.namespace = namespace
|
||||
# Check command line parameters sanity, and error out in case of problem.
|
||||
check_config_sanity(self)
|
||||
|
||||
def __getattr__(self, name):
|
||||
|
|
@ -120,7 +121,7 @@ def check_config_sanity(config):
|
|||
"""
|
||||
# Port check
|
||||
if config.http01_port == config.tls_sni_01_port:
|
||||
raise errors.Error(
|
||||
raise errors.ConfigurationError(
|
||||
"Trying to run http-01 and tls-sni-01 "
|
||||
"on the same port ({0})".format(config.tls_sni_01_port))
|
||||
|
||||
|
|
@ -134,7 +135,9 @@ def _check_config_domain_sanity(domains):
|
|||
domain flag values and errors out if the requirements are not met.
|
||||
|
||||
:param domains: List of domains
|
||||
:type args: `list` of `string`
|
||||
:type domains: `list` of `string`
|
||||
:raises ConfigurationError: for invalid domains and cases where Let's
|
||||
Encrypt currently will not issue certificates
|
||||
|
||||
"""
|
||||
# Check if there's a wildcard domain
|
||||
|
|
@ -145,8 +148,10 @@ def _check_config_domain_sanity(domains):
|
|||
if any("xn--" in d for d in domains):
|
||||
raise errors.ConfigurationError(
|
||||
"Punycode domains are not supported")
|
||||
# FQDN, checks:
|
||||
# FQDN checks from
|
||||
# http://www.mkyong.com/regular-expressions/domain-name-regular-expression-example/
|
||||
# Characters used, domain parts < 63 chars, tld > 1 < 7 chars
|
||||
# first and last char is not "-"
|
||||
fqdn = re.compile("^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,6}$")
|
||||
if any(True for d in domains if not fqdn.match(d)):
|
||||
raise errors.ConfigurationError("Requested domain is not FQDN")
|
||||
raise errors.ConfigurationError("Requested domain is not a FQDN")
|
||||
|
|
|
|||
|
|
@ -95,5 +95,6 @@ class StandaloneBindError(Error):
|
|||
self.socket_error = socket_error
|
||||
self.port = port
|
||||
|
||||
|
||||
class ConfigurationError(Error):
|
||||
"""Configuration sanity error."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue