From e7d7e5d668a70d404d6d8947a29d26a5215ae2a6 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Thu, 22 Jan 2026 15:04:27 +0100 Subject: [PATCH 1/3] bumps to 1.5.1 --- release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yaml b/release.yaml index c957577..b88c61f 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: application-hub image_prefix: eoepca -image_version: 1.5.0 +image_version: 1.5.1 image_registry: ghcr.io \ No newline at end of file From 152ba12e122ecc5721ee9b5ccb8ccf5d116cf626 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Mon, 26 Jan 2026 11:51:36 +0100 Subject: [PATCH 2/3] fixes config parser --- application_hub_context/parser.py | 55 +++++++++++++++++++++---------- setup.cfg | 2 +- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/application_hub_context/parser.py b/application_hub_context/parser.py index 64e37c9..0f63dac 100644 --- a/application_hub_context/parser.py +++ b/application_hub_context/parser.py @@ -11,26 +11,47 @@ def __init__(self, config_data, user_groups): self.config = Config(**config_data) self.user_groups = user_groups + @classmethod + def _render_templates(cls, obj, context): + """Recursively render Jinja templates in strings only.""" + if isinstance(obj, str): + if "{{" in obj: + return Template(obj).render(**context) + return obj + + if isinstance(obj, list): + return [cls._render_templates(i, context) for i in obj] + + if isinstance(obj, dict): + return { + k: cls._render_templates(v, context) + for k, v in obj.items() + } + + return obj + @classmethod def read_file(cls, config_path, user_groups, spawner, namespace): - """reads a config file encoded in YAML""" with open(config_path, "r") as stream: - try: - # Read the file as a raw string - raw_content = stream.read() - - # Render the content as a Jinja2 template - template = Template(raw_content) - rendered_content = template.render(spawner=spawner, - namespace=namespace) - - # Parse the rendered content as YAML - config_data = yaml.safe_load(rendered_content) - - except yaml.YAMLError as exc: - print(f"YAML Error: {exc}") - except Exception as e: - print(f"Error: {e}") + raw_content = stream.read() + + try: + # Parse YAML first (SAFE) + config_data = yaml.safe_load(raw_content) + + # Render templates selectively + context = { + "spawner": spawner, + "namespace": namespace, + } + config_data = cls._render_templates(config_data, context) + + except yaml.YAMLError as exc: + raise RuntimeError(f"Invalid YAML in {config_path}: {exc}") from exc + except Exception as exc: + raise RuntimeError( + f"Error processing config file {config_path}: {exc}" + ) from exc return cls(config_data=config_data, user_groups=user_groups) diff --git a/setup.cfg b/setup.cfg index 135c20e..bdd13ef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [metadata] name = application-context-hub -version = 1.3.3 +version = 1.5.2 From 3720b18b0b11bdbe16f15277c235c1948497808a Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Mon, 26 Jan 2026 15:17:22 +0100 Subject: [PATCH 3/3] bumps to 1.5.2 --- release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yaml b/release.yaml index b88c61f..2b900aa 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: application-hub image_prefix: eoepca -image_version: 1.5.1 +image_version: 1.5.2 image_registry: ghcr.io \ No newline at end of file