mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Improving exception handling
This commit is contained in:
parent
005d624f2f
commit
6aa64a071f
2 changed files with 12 additions and 10 deletions
|
@ -256,5 +256,6 @@
|
|||
"certmanager_cert_signing_failed" : "Signing the new certificate failed.",
|
||||
"certmanager_no_cert_file" : "Unable to read certificate file for domain {domain:s} (file : {file:s})",
|
||||
"certmanager_conflicting_nginx_file": "Unable to prepare domain for ACME challenge : the nginx configuration file {filepath:s} is conflicting and should be removed first.",
|
||||
"certmanager_unable_to_determine_self_CA_name": "Unable to determine name of self-signing authority."
|
||||
"certmanager_self_ca_conf_file_not_found" : "Configuration file not found for self-signing CA ({file:s})",
|
||||
"certmanager_unable_to_parse_self_CA_name": "Unable to parse name of self-signing authority in {file:s}."
|
||||
}
|
||||
|
|
|
@ -812,17 +812,18 @@ def _domain_is_accessible_through_HTTP(ip, domain):
|
|||
def _name_self_CA():
|
||||
ca_conf = os.path.join(SSL_DIR, "openssl.ca.cnf")
|
||||
|
||||
try :
|
||||
with open(ca_conf) as f:
|
||||
lines = f.readlines()
|
||||
if not os.path.exists(ca_conf) :
|
||||
logger.warning(m18n.n('certmanager_self_ca_conf_file_not_found', file=ca_conf))
|
||||
return ""
|
||||
|
||||
for line in lines:
|
||||
if line.startswith("commonName_default"):
|
||||
return line.split()[2]
|
||||
except:
|
||||
pass
|
||||
with open(ca_conf) as f:
|
||||
lines = f.readlines()
|
||||
|
||||
logger.warning(m18n.n('certmanager_unable_to_determine_self_CA_name'))
|
||||
for line in lines:
|
||||
if line.startswith("commonName_default"):
|
||||
return line.split()[2]
|
||||
|
||||
logger.warning(m18n.n('certmanager_unable_to_parse_self_CA_name', file=ca_conf))
|
||||
return ""
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue