Implement first function

This commit is contained in:
Mirco 2022-12-19 10:40:11 +01:00
parent 570a31a9f9
commit af8b2571e2

View file

@ -4,22 +4,24 @@ from subprocess import run
#from .devops_build import DevopsBuild #from .devops_build import DevopsBuild
def add_c4k_mixin_config(config, def add_c4k_mixin_config(config,
config_keys, c4k_config_dict=None,
auth_keys, c4k_auth_dict=None):
c4k_config_template=None, if c4k_config_dict == None:
c4k_auth_template=None): c4k_config_dict = {}
if c4k_config_template == None: if c4k_auth_dict == None:
c4k_config_template = '{' c4k_auth_dict = {}
for key in config_keys:
c4k_config_template += f':{key} "${key}"\n' config.update({'C4kMixinConfig': c4k_config_dict})
c4k_config_template += '}' config.update({'C4kMixinAuth': c4k_auth_dict})
if c4k_auth_template == None: return config
c4k_auth_template = '{'
for key in auth_keys:
c4k_auth_template += f':{key} "${key}"\n'
c4k_auth_template += '}'
def generate_default_template(keys):
config_template = '{'
for key in keys:
config_template += f':{key} "${key}"\n'
config_template += '}'
return config_template
#DevopsBuild #DevopsBuild
@ -27,7 +29,8 @@ class C4kMixin():
def __init__(self, project, config): def __init__(self, project, config):
super().__init__(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): def write_c4k_config(self):
raise NotImplemented raise NotImplemented
@ -38,4 +41,5 @@ class C4kMixin():
def c4k_apply(self): def c4k_apply(self):
raise NotImplemented raise NotImplemented
add_c4k_mixin_config({}, ['test', 'test2', 'fqdn'], []) add_c4k_mixin_config({}, ['test', 'test2', 'fqdn'], [])