Skip to content

Commit

Permalink
unify the logic how the provided template data is stored (#456)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
defreng authored Mar 1, 2024
1 parent f4cc67d commit f2b0c4e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/foxops/engine/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/foxops/services/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)

Expand Down
4 changes: 2 additions & 2 deletions tests/engine/test_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f2b0c4e

Please sign in to comment.