qontract-reconcile 0.10.1rc755__py3-none-any.whl → 0.10.1rc756__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.1rc755
3
+ Version: 0.10.1rc756
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
@@ -426,7 +426,7 @@ reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9
426
426
  reconcile/templates/rosa-classic-cluster-creation.sh.j2,sha256=0UHfYtXRVJqP07VJQx456cRI6EbZNBgamtP_8nb4WPY,2353
427
427
  reconcile/templates/rosa-hcp-cluster-creation.sh.j2,sha256=O7Bf3WQIJhsZoEqaYA0wRktUO4yXXCb4BQkuvvp-C80,2385
428
428
  reconcile/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
429
- reconcile/templating/renderer.py,sha256=PrFRJc8X1O0hXGFd_HYQ01cMbkWqxj-Gu3dQxG7iXFg,10546
429
+ reconcile/templating/renderer.py,sha256=xDuEOD6OBAaBYQzDcQ8ptwZQaarhHa-y1knN4d2xzkY,10598
430
430
  reconcile/templating/validator.py,sha256=pvDEc6veznEZzjypkoRJUGMMFLWosU-zd7i3j7JeNjE,4670
431
431
  reconcile/templating/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
432
432
  reconcile/templating/lib/merge_request_manager.py,sha256=JUkfF3smaQ8onzKF5F7UpmA7MWaQpftANy6dDo1FCug,5464
@@ -783,8 +783,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
783
783
  tools/test/test_qontract_cli.py,sha256=w2l4BHB09k1d-BGJ1jBUNCqDv7zkqYrMHojQXg-21kQ,4155
784
784
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
785
785
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
786
- qontract_reconcile-0.10.1rc755.dist-info/METADATA,sha256=kakntqv9m6oYmZ-sI6t-ZJmUfpJuDDPcKwTIMHsMpko,2382
787
- qontract_reconcile-0.10.1rc755.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
788
- qontract_reconcile-0.10.1rc755.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
789
- qontract_reconcile-0.10.1rc755.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
790
- qontract_reconcile-0.10.1rc755.dist-info/RECORD,,
786
+ qontract_reconcile-0.10.1rc756.dist-info/METADATA,sha256=e3uCbsaVAAU1U51hxqtUNTNVP_7hwDox4K9PcBo6J_c,2382
787
+ qontract_reconcile-0.10.1rc756.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
788
+ qontract_reconcile-0.10.1rc756.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
789
+ qontract_reconcile-0.10.1rc756.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
790
+ qontract_reconcile-0.10.1rc756.dist-info/RECORD,,
@@ -1,5 +1,3 @@
1
- import hashlib
2
- import json
3
1
  import logging
4
2
  import os
5
3
  import tempfile
@@ -7,6 +5,7 @@ from abc import ABC, abstractmethod
7
5
  from collections.abc import Callable
8
6
  from typing import Any, Optional, Self
9
7
 
8
+ from deepdiff import DeepHash
10
9
  from ruamel import yaml
11
10
 
12
11
  from reconcile.gql_definitions.templating.template_collection import (
@@ -175,6 +174,14 @@ def unpack_dynamic_variables(
175
174
  }
176
175
 
177
176
 
177
+ def calc_template_hash(c: TemplateCollectionV1, variables: dict[str, Any]) -> str:
178
+ hashable = {
179
+ "templates": sorted(c.templates, key=lambda x: x.name),
180
+ "variables": variables,
181
+ }
182
+ return DeepHash(hashable)[hashable]
183
+
184
+
178
185
  class TemplateRendererIntegrationParams(PydanticRunParams):
179
186
  clone_repo: bool = False
180
187
  app_interface_data_path: Optional[str]
@@ -246,16 +253,10 @@ class TemplateRendererIntegration(QontractReconcileIntegration):
246
253
  "static": unpack_static_variables(c.variables),
247
254
  }
248
255
 
249
- template_hash = hashlib.sha256(
250
- "".join(
251
- sorted([str(t) for t in c.templates] + [json.dumps(variables)])
252
- ).encode("utf-8")
253
- ).hexdigest()
254
-
255
256
  with PersistenceTransaction(persistence, dry_run) as p:
256
257
  input = TemplateInput(
257
258
  collection=c.name,
258
- collection_hash=template_hash,
259
+ collection_hash=calc_template_hash(c, variables),
259
260
  enable_auto_approval=c.enable_auto_approval or False,
260
261
  labels=c.additional_mr_labels or [],
261
262
  )