From 4c11d3172317b5d018b943c1ca923c15077c4af6 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 22 Dec 2022 22:34:27 +0100 Subject: [PATCH] Move generate_clojure_map inside class --- src/main/python/ddadevops/c4k_mixin.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/python/ddadevops/c4k_mixin.py b/src/main/python/ddadevops/c4k_mixin.py index ab8658e..94e1fad 100644 --- a/src/main/python/ddadevops/c4k_mixin.py +++ b/src/main/python/ddadevops/c4k_mixin.py @@ -15,14 +15,6 @@ def add_c4k_mixin_config(config, return config -def generate_clojure_map(template_dict): - clojure_map_str = '{' - for key, value in template_dict.items(): - clojure_map_str += f':{key} "{value}"\n' - clojure_map_str += '}' - return clojure_map_str - - class C4kMixin(DevopsBuild): def __init__(self, project, config): @@ -31,15 +23,22 @@ class C4kMixin(DevopsBuild): self.c4k_mixin_auth = config['C4kMixin']['Auth'] self.c4k_module_name = config['C4kMixin']['Name'] + def __generate_clojure_map(template_dict): + clojure_map_str = '{' + for key, value in template_dict.items(): + clojure_map_str += f':{key} "{value}"\n' + clojure_map_str += '}' + return clojure_map_str + def write_c4k_config(self): fqdn = self.get('fqdn') self.c4k_mixin_config.update({'fqdn':fqdn}) with open(self.build_path() + '/out_config.edn', 'w') as output_file: - output_file.write(generate_clojure_map(self.c4k_mixin_config)) + output_file.write(self.__generate_clojure_map(self.c4k_mixin_config)) def write_c4k_auth(self): with open(self.build_path() + '/out_auth.edn', 'w') as output_file: - output_file.write(generate_clojure_map(self.c4k_mixin_auth)) + output_file.write(self.__generate_clojure_map(self.c4k_mixin_auth)) chmod(self.build_path() + '/out_auth.edn', 0o600) def c4k_apply(self):