qontract-reconcile 0.10.1rc872__py3-none-any.whl → 0.10.1rc873__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc872
3
+ Version: 0.10.1rc873
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -461,7 +461,7 @@ reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9
461
461
  reconcile/templates/rosa-classic-cluster-creation.sh.j2,sha256=0UHfYtXRVJqP07VJQx456cRI6EbZNBgamtP_8nb4WPY,2353
462
462
  reconcile/templates/rosa-hcp-cluster-creation.sh.j2,sha256=O7Bf3WQIJhsZoEqaYA0wRktUO4yXXCb4BQkuvvp-C80,2385
463
463
  reconcile/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
464
- reconcile/templating/renderer.py,sha256=xDuEOD6OBAaBYQzDcQ8ptwZQaarhHa-y1knN4d2xzkY,10598
464
+ reconcile/templating/renderer.py,sha256=HfPjE7bl8RjpZbesgfx8HYCfHimkdYO7whst5HJsFeY,10851
465
465
  reconcile/templating/validator.py,sha256=pvDEc6veznEZzjypkoRJUGMMFLWosU-zd7i3j7JeNjE,4670
466
466
  reconcile/templating/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
467
467
  reconcile/templating/lib/merge_request_manager.py,sha256=JUkfF3smaQ8onzKF5F7UpmA7MWaQpftANy6dDo1FCug,5464
@@ -837,8 +837,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
837
837
  tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
838
838
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
839
839
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
840
- qontract_reconcile-0.10.1rc872.dist-info/METADATA,sha256=p_PdfV2I8OB1Hjx60nEtkH_jBTfFpdxm194hKgak7q0,2273
841
- qontract_reconcile-0.10.1rc872.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
842
- qontract_reconcile-0.10.1rc872.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
843
- qontract_reconcile-0.10.1rc872.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
844
- qontract_reconcile-0.10.1rc872.dist-info/RECORD,,
840
+ qontract_reconcile-0.10.1rc873.dist-info/METADATA,sha256=9lqM-J5VZfZdZRP1Q4mtjPjMLPXY8YLThOOA2rXy3Yo,2273
841
+ qontract_reconcile-0.10.1rc873.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
842
+ qontract_reconcile-0.10.1rc873.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
843
+ qontract_reconcile-0.10.1rc873.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
844
+ qontract_reconcile-0.10.1rc873.dist-info/RECORD,,
@@ -3,6 +3,7 @@ import os
3
3
  import tempfile
4
4
  from abc import ABC, abstractmethod
5
5
  from collections.abc import Callable
6
+ from pathlib import Path
6
7
  from typing import Any, Optional, Self
7
8
 
8
9
  from deepdiff import DeepHash
@@ -30,6 +31,7 @@ from reconcile.typed_queries.gitlab_instances import get_gitlab_instances
30
31
  from reconcile.utils import gql
31
32
  from reconcile.utils.git import clone
32
33
  from reconcile.utils.gql import init_from_config
34
+ from reconcile.utils.jinja2.utils import process_jinja2_template
33
35
  from reconcile.utils.ruamel import create_ruamel_instance
34
36
  from reconcile.utils.runtime.integration import (
35
37
  PydanticRunParams,
@@ -85,12 +87,9 @@ class LocalFilePersistence(FilePersistence):
85
87
 
86
88
  def write(self, outputs: list[TemplateOutput]) -> None:
87
89
  for output in outputs:
88
- with open(
89
- f"{join_path(self.app_interface_data_path, output.path)}",
90
- "w",
91
- encoding="utf-8",
92
- ) as f:
93
- f.write(output.content)
90
+ filepath = Path(join_path(self.app_interface_data_path, output.path))
91
+ filepath.parent.mkdir(parents=True, exist_ok=True)
92
+ filepath.write_text(output.content, encoding="utf-8")
94
93
 
95
94
  def read(self, path: str) -> Optional[str]:
96
95
  return self._read_local_file(join_path(self.app_interface_data_path, path))
@@ -166,12 +165,14 @@ def unpack_static_variables(
166
165
  def unpack_dynamic_variables(
167
166
  collection_variables: TemplateCollectionVariablesV1, gql: gql.GqlApi
168
167
  ) -> dict[str, dict[str, Any]]:
169
- if not collection_variables.dynamic:
170
- return {}
171
-
172
- return {
173
- dv.name: gql.query(dv.query) or {} for dv in collection_variables.dynamic or []
174
- }
168
+ static = collection_variables.static or {}
169
+ dynamic: dict[str, dict[str, Any]] = {}
170
+ for dv in collection_variables.dynamic or []:
171
+ query = process_jinja2_template(
172
+ body=dv.query, vars={"static": static, "dynamic": dynamic}
173
+ )
174
+ dynamic[dv.name] = gql.query(query) or {}
175
+ return dynamic
175
176
 
176
177
 
177
178
  def calc_template_hash(c: TemplateCollectionV1, variables: dict[str, Any]) -> str: