From 565125f8bc7e215acbd7dc56ed5146fb5dbddcf7 Mon Sep 17 00:00:00 2001 From: Alexander Hungenberg Date: Thu, 29 Feb 2024 21:59:33 +0100 Subject: [PATCH 1/2] unify the logic how the provided template data is stored to prevent inconsistencies between creation/updates of an incarnation, the .fengine.yaml template_data is now configured to always contain all the data provided by the user. No longer limiting it to values that are provided for valid variables or that are different from the defaults --- src/foxops/engine/initialization.py | 2 +- src/foxops/services/change.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/foxops/engine/initialization.py b/src/foxops/engine/initialization.py index f9fb1aae..e9241af4 100644 --- a/src/foxops/engine/initialization.py +++ b/src/foxops/engine/initialization.py @@ -62,7 +62,7 @@ async def initialize_incarnation( template_repository=template_repository, template_repository_version=template_repository_version, template_repository_version_hash=template_repository_version_hash, - template_data=template_data_model.model_dump(exclude_defaults=True), + template_data=template_data, template_data_full=full_template_data, ) incarnation_state.save(incarnation_root_dir / ".fengine.yaml") diff --git a/src/foxops/services/change.py b/src/foxops/services/change.py index 0508353f..18c6a85e 100644 --- a/src/foxops/services/change.py +++ b/src/foxops/services/change.py @@ -188,7 +188,7 @@ async def create_incarnation( commit_sha=commit_sha, requested_version_hash=incarnation_state.template_repository_version_hash, requested_version=template_repository_version, - requested_data=json.dumps(template_data), + requested_data=json.dumps(incarnation_state.template_data), template_data_full=json.dumps(incarnation_state.template_data_full), ) From e025eaed5b1ee0fb9d2b10d5b5d2269bc9a2fa52 Mon Sep 17 00:00:00 2001 From: Alexander Hungenberg Date: Thu, 29 Feb 2024 22:11:19 +0100 Subject: [PATCH 2/2] fix test --- tests/engine/test_initialization.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/engine/test_initialization.py b/tests/engine/test_initialization.py index ad5d1387..2c998781 100644 --- a/tests/engine/test_initialization.py +++ b/tests/engine/test_initialization.py @@ -272,5 +272,5 @@ async def test_initialize_template_adds_additional_variables_to_state(tmp_path): # THEN assert incarnation_state is not None - assert "additional_variable_1" not in incarnation_state.template_data - assert "additional_variable_2" not in incarnation_state.template_data + assert "additional_variable_1" in incarnation_state.template_data + assert "additional_variable_2" in incarnation_state.template_data