mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] pep8
This commit is contained in:
parent
86eb9a2405
commit
2f4f254612
1 changed files with 11 additions and 8 deletions
|
@ -173,7 +173,7 @@ def _certificate_install_selfsigned(domain_list, force=False):
|
||||||
|
|
||||||
# Check we ain't trying to overwrite a good cert !
|
# Check we ain't trying to overwrite a good cert !
|
||||||
current_cert_file = os.path.join(CERT_FOLDER, domain, "crt.pem")
|
current_cert_file = os.path.join(CERT_FOLDER, domain, "crt.pem")
|
||||||
if (not force) and (os.path.isfile(current_cert_file)):
|
if not force and os.path.isfile(current_cert_file):
|
||||||
status = _get_status(domain)
|
status = _get_status(domain)
|
||||||
|
|
||||||
if status["summary"]["code"] in ('good', 'great'):
|
if status["summary"]["code"] in ('good', 'great'):
|
||||||
|
@ -350,7 +350,7 @@ def certificate_renew(auth, domain_list, force=False, no_checks=False, email=Fal
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n(
|
raise MoulinetteError(errno.EINVAL, m18n.n(
|
||||||
'certmanager_attempt_to_renew_nonLE_cert', domain=domain))
|
'certmanager_attempt_to_renew_nonLE_cert', domain=domain))
|
||||||
|
|
||||||
if (staging):
|
if staging:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Please note that you used the --staging option, and that no new certificate will actually be enabled !")
|
"Please note that you used the --staging option, and that no new certificate will actually be enabled !")
|
||||||
|
|
||||||
|
@ -456,11 +456,14 @@ location '/.well-known/acme-challenge'
|
||||||
# Check there isn't a conflicting file for the acme-challenge well-known
|
# Check there isn't a conflicting file for the acme-challenge well-known
|
||||||
# uri
|
# uri
|
||||||
for path in glob.glob('%s/*.conf' % nginx_conf_folder):
|
for path in glob.glob('%s/*.conf' % nginx_conf_folder):
|
||||||
if (path == nginx_conf_file):
|
|
||||||
|
if path == nginx_conf_file:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
if ('/.well-known/acme-challenge' in contents):
|
|
||||||
|
if '/.well-known/acme-challenge' in contents:
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n(
|
raise MoulinetteError(errno.EINVAL, m18n.n(
|
||||||
'certmanager_conflicting_nginx_file', filepath=path))
|
'certmanager_conflicting_nginx_file', filepath=path))
|
||||||
|
|
||||||
|
@ -512,7 +515,7 @@ def _fetch_and_enable_new_certificate(domain, staging=False):
|
||||||
|
|
||||||
domain_csr_file = "%s/%s.csr" % (TMP_FOLDER, domain)
|
domain_csr_file = "%s/%s.csr" % (TMP_FOLDER, domain)
|
||||||
|
|
||||||
if (staging):
|
if staging:
|
||||||
certification_authority = STAGING_CERTIFICATION_AUTHORITY
|
certification_authority = STAGING_CERTIFICATION_AUTHORITY
|
||||||
else:
|
else:
|
||||||
certification_authority = PRODUCTION_CERTIFICATION_AUTHORITY
|
certification_authority = PRODUCTION_CERTIFICATION_AUTHORITY
|
||||||
|
@ -524,7 +527,7 @@ def _fetch_and_enable_new_certificate(domain, staging=False):
|
||||||
log=logger,
|
log=logger,
|
||||||
CA=certification_authority)
|
CA=certification_authority)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if ("urn:acme:error:rateLimited" in str(e)):
|
if "urn:acme:error:rateLimited" in str(e):
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n(
|
raise MoulinetteError(errno.EINVAL, m18n.n(
|
||||||
'certmanager_hit_rate_limit', domain=domain))
|
'certmanager_hit_rate_limit', domain=domain))
|
||||||
else:
|
else:
|
||||||
|
@ -544,7 +547,7 @@ def _fetch_and_enable_new_certificate(domain, staging=False):
|
||||||
# Create corresponding directory
|
# Create corresponding directory
|
||||||
date_tag = datetime.now().strftime("%Y%m%d.%H%M%S")
|
date_tag = datetime.now().strftime("%Y%m%d.%H%M%S")
|
||||||
|
|
||||||
if (staging):
|
if staging:
|
||||||
folder_flag = "staging"
|
folder_flag = "staging"
|
||||||
else:
|
else:
|
||||||
folder_flag = "letsencrypt"
|
folder_flag = "letsencrypt"
|
||||||
|
@ -567,7 +570,7 @@ def _fetch_and_enable_new_certificate(domain, staging=False):
|
||||||
|
|
||||||
_set_permissions(domain_cert_file, "root", "metronome", 0640)
|
_set_permissions(domain_cert_file, "root", "metronome", 0640)
|
||||||
|
|
||||||
if (staging):
|
if staging:
|
||||||
return
|
return
|
||||||
|
|
||||||
_enable_certificate(domain, new_cert_folder)
|
_enable_certificate(domain, new_cert_folder)
|
||||||
|
|
Loading…
Add table
Reference in a new issue