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 ...@@ -5,7 +5,7 @@ import configparser
import wile_coyote.common.constants 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""" """combine certificate, CA and private key"""
if os.path.isdir("/etc/ssl/certs"): if os.path.isdir("/etc/ssl/certs"):
ssl_dir = "/etc/ssl/certs" ssl_dir = "/etc/ssl/certs"
...@@ -18,10 +18,9 @@ def keys(cert_path, provider, key_path, outpath): ...@@ -18,10 +18,9 @@ def keys(cert_path, provider, key_path, outpath):
config.read(wile_coyote.common.constants.CRED_CONF, encoding="utf8") config.read(wile_coyote.common.constants.CRED_CONF, encoding="utf8")
ca_file = config.get("ca", provider) ca_file = config.get("ca", provider)
ca_path = os.path.join(ssl_dir, ca_file) 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: with open(out_path, "w", encoding="utf-8") as out_file:
for fname in file_names: for fname in [cert_path, ca_path, key_path]:
with open(fname, "r", encoding="utf-8") as infile: with open(fname, "r", encoding="utf-8") as in_file:
outfile.write(infile.read()) out_file.write(in_file.read())
outfile.close() out_file.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment