From 4ee9afcf35034c33fdfc578feb7366a4bdaa903c Mon Sep 17 00:00:00 2001 From: Matteo Voges Date: Wed, 20 Sep 2023 11:33:37 +0200 Subject: [PATCH] fix(oc): write resolver handle readonly flag --- kapitan/inventory/resolvers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kapitan/inventory/resolvers.py b/kapitan/inventory/resolvers.py index 8cc6bcbfb..4e2474e75 100644 --- a/kapitan/inventory/resolvers.py +++ b/kapitan/inventory/resolvers.py @@ -135,6 +135,7 @@ def write_to_key(destination: str, origin: str, _root_): # resolve relative interpolations try: + # TODO: replace with OC.to_object(), when it supports escaped interpolations copied = copy.deepcopy(content) OmegaConf.resolve(copied, True) except Exception as e: @@ -142,7 +143,14 @@ def write_to_key(destination: str, origin: str, _root_): logger.warning(e) # write resolved content back to _root_ - OmegaConf.update(_root_, destination, copied, merge=True, force_add=True) + # OmegaConf.set_readonly(copied.server, False) + # print(copied) + # print(copied.server._get_flag("readonly")) + # TODO: replace current workaround with clean flag overriding + obj = OmegaConf.to_container(copied) + config = OmegaConf.create(obj) + + OmegaConf.update(_root_, destination, config, merge=True, force_add=True) except Exception as e: raise e return "DONE"