qontract-reconcile 0.10.1rc754__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.1rc754
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
@@ -663,7 +663,7 @@ reconcile/utils/state.py,sha256=FK8NLT1xyumuXpYRm0Nk6pWpOE_U6-NovGn6zKCw8vw,1629
663
663
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
664
664
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
665
665
  reconcile/utils/terraform_client.py,sha256=mZEKpu6nbfiQd60wRkc8-5sljBTUTOgaAKnF89itMzU,32085
666
- reconcile/utils/terrascript_aws_client.py,sha256=fiRBl2JpM_UJrjC2x2klYjwoD2fi-BiRG7acPo6RuQ4,272663
666
+ reconcile/utils/terrascript_aws_client.py,sha256=4FR4JUSniDOFMtc_r1t2z0x_drrBfcw-J33AdWeJEyw,272662
667
667
  reconcile/utils/three_way_diff_strategy.py,sha256=nyqeQsLCoPI6e16k2CF3b9KNgQLU-rPf5RtfdUfVMwE,4468
668
668
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
669
669
  reconcile/utils/unleash.py,sha256=1D56CsZfE3ShDtN3IErE1T2eeIwNmxhK-yYbCotJ99E,3601
@@ -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.1rc754.dist-info/METADATA,sha256=OD3FoCxX0CTq2h4QAdvIIjPG_kpBIaUZmsRyAbRSduU,2382
787
- qontract_reconcile-0.10.1rc754.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
788
- qontract_reconcile-0.10.1rc754.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
789
- qontract_reconcile-0.10.1rc754.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
790
- qontract_reconcile-0.10.1rc754.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
  )
@@ -298,6 +298,10 @@ class aws_cloudfront_log_delivery_canonical_user_id(Data):
298
298
  pass
299
299
 
300
300
 
301
+ class cloudinit_config(Data):
302
+ pass
303
+
304
+
301
305
  # temporary until we upgrade to a terrascript release
302
306
  # that supports this provider
303
307
  # https://github.com/mjuenema/python-terrascript/pull/166
@@ -436,9 +440,9 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
436
440
  "source": "hashicorp/random",
437
441
  "version": "3.4.3",
438
442
  },
439
- "template": {
440
- "source": "hashicorp/template",
441
- "version": "2.2.0",
443
+ "cloudinit": {
444
+ "source": "hashicorp/cloudinit",
445
+ "version": "2.3.3",
442
446
  },
443
447
  },
444
448
  required_version=TERRAFORM_VERSION[0],
@@ -5428,9 +5432,7 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
5428
5432
  "content": content,
5429
5433
  })
5430
5434
  cloudinit_value = {"gzip": True, "base64_encode": True, "part": part}
5431
- cloudinit_data = data.template_cloudinit_config(
5432
- identifier, **cloudinit_value
5433
- )
5435
+ cloudinit_data = cloudinit_config(identifier, **cloudinit_value)
5434
5436
  tf_resources.append(cloudinit_data)
5435
5437
  template_values["user_data"] = "${" + cloudinit_data.rendered + "}"
5436
5438
  template_resource = aws_launch_template(identifier, **template_values)