[mod] merge double with

This commit is contained in:
Laurent Peuch 2016-11-28 14:42:36 +01:00
parent 2f4f254612
commit 4a9b89d12e

View file

@ -185,10 +185,9 @@ def _certificate_install_selfsigned(domain_list, force=False):
# Create our conf file, based on template, replacing the occurences of # Create our conf file, based on template, replacing the occurences of
# "yunohost.org" with the given domain # "yunohost.org" with the given domain
with open(conf_file, "w") as f: with open(conf_file, "w") as f, open(conf_template, "r") as template:
with open(conf_template, "r") as template: for line in template:
for line in template: f.write(line.replace("yunohost.org", domain))
f.write(line.replace("yunohost.org", domain))
# Use OpenSSL command line to create a certificate signing request, # Use OpenSSL command line to create a certificate signing request,
# and self-sign the cert # and self-sign the cert
@ -216,10 +215,9 @@ def _certificate_install_selfsigned(domain_list, force=False):
os.symlink(original_ca_file, ca_file) os.symlink(original_ca_file, ca_file)
# Append ca.pem at the end of crt.pem # Append ca.pem at the end of crt.pem
with open(ca_file, "r") as ca_pem: with open(ca_file, "r") as ca_pem, open(crt_file, "a") as crt_pem:
with open(crt_file, "a") as crt_pem: crt_pem.write("\n")
crt_pem.write("\n") crt_pem.write(ca_pem.read())
crt_pem.write(ca_pem.read())
# Set appropriate permissions # Set appropriate permissions
_set_permissions(new_cert_folder, "root", "root", 0755) _set_permissions(new_cert_folder, "root", "root", 0755)