Skip to content
Snippets Groups Projects
Unverified Commit 750c527d authored by Max Adamo's avatar Max Adamo
Browse files

minor code refactoring

parent 02a18802
Branches main
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ import configparser
import wile_coyote.common.constants
def keys(cert_path, provider, key_path, outpath):
def keys(cert_path, provider, key_path, out_path):
"""combine certificate, CA and private key"""
if os.path.isdir("/etc/ssl/certs"):
ssl_dir = "/etc/ssl/certs"
......@@ -18,10 +18,9 @@ def keys(cert_path, provider, key_path, outpath):
config.read(wile_coyote.common.constants.CRED_CONF, encoding="utf8")
ca_file = config.get("ca", provider)
ca_path = os.path.join(ssl_dir, ca_file)
file_names = [cert_path, ca_path, key_path]
with open(outpath, "w", encoding="utf-8") as outfile:
for fname in file_names:
with open(fname, "r", encoding="utf-8") as infile:
outfile.write(infile.read())
outfile.close()
with open(out_path, "w", encoding="utf-8") as out_file:
for fname in [cert_path, ca_path, key_path]:
with open(fname, "r", encoding="utf-8") as in_file:
out_file.write(in_file.read())
out_file.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment