From 8b350e0f6f2d0cabf73339457323d603ab0e512e Mon Sep 17 00:00:00 2001 From: jankovicn <nikola.jankovic@eox.at> Date: Tue, 2 Nov 2021 12:44:25 +0100 Subject: [PATCH] updated to work with new template structure --- vs_starter/config.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/vs_starter/config.py b/vs_starter/config.py index d3c28cf..4da6196 100644 --- a/vs_starter/config.py +++ b/vs_starter/config.py @@ -12,7 +12,7 @@ def render_config( ) -> None: # get helm data configmaps = get_helm_data(helm_config_path, file_type="configmap") - env = get_helm_data(helm_config_path, file_type="registrar-deployment", index=True) + env = get_helm_data(helm_config_path, file_type="deployment", index=True) # extract envs envs = extract_env_vars(env) @@ -38,11 +38,21 @@ def get_helm_data(helm_config_path: str, file_type: str, index: bool = False) -> if not os.path.isdir(helm_config_path): raise ValueError(f"{helm_config_path} is not a directory") - files = [ - os.path.join(helm_config_path, f) - for f in os.listdir(helm_config_path) - if os.path.isfile(os.path.join(helm_config_path, f)) and file_type in f - ] + to_remove = ["redis", "renderer", "database"] + rendered_templates = os.listdir(helm_config_path) + + for template in to_remove: + rendered_templates.remove(template) + + files = [] + for template_dir in rendered_templates: + template_path = os.path.join(helm_config_path, template_dir) + template_path = os.path.join(template_path, "templates") + for f in os.listdir(template_path): + if file_type in f and os.path.isfile( + template_file := os.path.join(template_path, f) + ): + files.append(template_file) if index: return files[0] -- GitLab