From 80c57ad4eb587bd2cd81129fcf7786cfd8f99ad6 Mon Sep 17 00:00:00 2001 From: Argyrios Samourkasidis Date: Sun, 22 Oct 2023 19:23:22 +0200 Subject: [PATCH] Fix FileType issue - args.FileType returns a FileType object. `load_cert_chain` expects public/private key paths as `str`. `name` attribute (of `FileType`) returns exactly what is needed. --- prometheus_aioexporter/script.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prometheus_aioexporter/script.py b/prometheus_aioexporter/script.py index f7979a4..f843bf6 100644 --- a/prometheus_aioexporter/script.py +++ b/prometheus_aioexporter/script.py @@ -188,11 +188,13 @@ def _get_ssl_context(self, args: argparse.Namespace) -> SSLContext | None: return None cafile = None if args.ssl_ca: - cafile = args.ssl_ca + cafile = args.ssl_ca.name ssl_context = ssl.create_default_context( purpose=ssl.Purpose.CLIENT_AUTH, cafile=cafile ) - ssl_context.load_cert_chain(args.ssl_public_key, args.ssl_private_key) + ssl_context.load_cert_chain( + args.ssl_public_key.name, args.ssl_private_key.name + ) return ssl_context