From af40580454da5cb023e38b936f4e3b92e5da75c5 Mon Sep 17 00:00:00 2001 From: Jose Rojas <39174181+jarojasm95@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:28:59 -0600 Subject: [PATCH] fix: Cast certificate cache path to string (#182) --- aladdin/lib/cache.py | 7 +++++-- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/aladdin/lib/cache.py b/aladdin/lib/cache.py index 695d6b6..3458b1e 100644 --- a/aladdin/lib/cache.py +++ b/aladdin/lib/cache.py @@ -20,6 +20,7 @@ def clear_on_error(): except Exception: logging.info("Clearing cache due to error") shutil.rmtree(cache_root, ignore_errors=True) + raise def certificate_cache(func): @@ -38,7 +39,10 @@ def certificate_cache(func): @functools.wraps(func) @clear_on_error() def wrapper(certificate_scope): - cache = shelve.open(cache_path) + if not ClusterRules().certificate_lookup_cache: + return func(certificate_scope) + + cache = shelve.open(str(cache_path)) data: dict = cache.get(certificate_scope) or {} age = time.time() - data.get("time", 0) @@ -47,7 +51,6 @@ def wrapper(certificate_scope): if ( not data or age > ttl.total_seconds() - or not ClusterRules().certificate_lookup_cache ): value = func(certificate_scope) cache[certificate_scope] = { diff --git a/pyproject.toml b/pyproject.toml index 9575be5..01c0997 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aladdin" -version = "1.29.8.7" +version = "1.29.8.8" description = "" authors = ["Fivestars "] include = [