From af8b2571e2c63f17fff788ec5bb41a3e1d51b218 Mon Sep 17 00:00:00 2001 From: Mirco Date: Mon, 19 Dec 2022 10:40:11 +0100 Subject: [PATCH] Implement first function --- src/main/python/ddadevops/c4k_mixin.py | 36 ++++++++++++++------------ 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/python/ddadevops/c4k_mixin.py b/src/main/python/ddadevops/c4k_mixin.py index 1929cfa..ffd51b0 100644 --- a/src/main/python/ddadevops/c4k_mixin.py +++ b/src/main/python/ddadevops/c4k_mixin.py @@ -4,22 +4,24 @@ from subprocess import run #from .devops_build import DevopsBuild def add_c4k_mixin_config(config, - config_keys, - auth_keys, - c4k_config_template=None, - c4k_auth_template=None): - if c4k_config_template == None: - c4k_config_template = '{' - for key in config_keys: - c4k_config_template += f':{key} "${key}"\n' - c4k_config_template += '}' - if c4k_auth_template == None: - c4k_auth_template = '{' - for key in auth_keys: - c4k_auth_template += f':{key} "${key}"\n' - c4k_auth_template += '}' - + c4k_config_dict=None, + c4k_auth_dict=None): + if c4k_config_dict == None: + c4k_config_dict = {} + if c4k_auth_dict == None: + c4k_auth_dict = {} + config.update({'C4kMixinConfig': c4k_config_dict}) + config.update({'C4kMixinAuth': c4k_auth_dict}) + return config + + +def generate_default_template(keys): + config_template = '{' + for key in keys: + config_template += f':{key} "${key}"\n' + config_template += '}' + return config_template #DevopsBuild @@ -27,7 +29,8 @@ class C4kMixin(): def __init__(self, project, config): super().__init__(project, config) - c4k_mixin_config = config['C4kMixin'] + self.c4k_mixin_config = config['C4kMixinConfig'] + self.c4k_mixin_auth = config['C4kMixinAuth'] def write_c4k_config(self): raise NotImplemented @@ -38,4 +41,5 @@ class C4kMixin(): def c4k_apply(self): raise NotImplemented + add_c4k_mixin_config({}, ['test', 'test2', 'fqdn'], [])