Move generate_clojure_map inside class
This commit is contained in:
parent
a803d022d9
commit
4c11d31723
1 changed files with 9 additions and 10 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue