qontract-reconcile 0.10.1rc871__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.1rc871
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
@@ -183,7 +183,7 @@ reconcile/dynatrace_token_provider/integration.py,sha256=NZOwk6t5X8p5fUo2FNsBgGH
183
183
  reconcile/dynatrace_token_provider/metrics.py,sha256=xiKkl8fTEBQaXJelGCPNTZhHAWdO1M3pCXNr_Tei63c,1285
184
184
  reconcile/external_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
185
185
  reconcile/external_resources/aws.py,sha256=JvjKaABy2Pg8u8Lq82Acv4zMvpE3_qGKes7OG-zlHOM,2956
186
- reconcile/external_resources/factories.py,sha256=bLboXX5Dq0xN60mtDGNjCOLC6HlKofXMWQxVbRwMMwo,4485
186
+ reconcile/external_resources/factories.py,sha256=DXgaLxoO87zZ76VOpRpu2GeYGhsbfOnOx5mrzgo4Gf4,4767
187
187
  reconcile/external_resources/integration.py,sha256=p07tnD4pww9QgFlHT18RRn929BL7zKzRHRvHQ_ETRAU,5113
188
188
  reconcile/external_resources/integration_secrets_sync.py,sha256=cMEZhgCvABAMf-DWF051L6CRnJQdfbsISA_b1xuS940,1670
189
189
  reconcile/external_resources/manager.py,sha256=d1YuCZWOnUV3nfZ0HJI-IIG5qef7eQ4ct7hSTXcFK4M,14576
@@ -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.1rc871.dist-info/METADATA,sha256=-LgSP8TnH7lS6H7ovYlSq3-sogHwbHk9t9qNKgjJxEY,2273
841
- qontract_reconcile-0.10.1rc871.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
842
- qontract_reconcile-0.10.1rc871.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
843
- qontract_reconcile-0.10.1rc871.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
844
- qontract_reconcile-0.10.1rc871.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,,
@@ -9,6 +9,7 @@ from reconcile.external_resources.aws import (
9
9
  AWSRdsFactory,
10
10
  AWSResourceFactory,
11
11
  )
12
+ from reconcile.external_resources.meta import QONTRACT_INTEGRATION
12
13
  from reconcile.external_resources.model import (
13
14
  ExternalResource,
14
15
  ExternalResourceKey,
@@ -28,6 +29,14 @@ from reconcile.utils.secret_reader import SecretReaderBase
28
29
 
29
30
  T = TypeVar("T")
30
31
 
32
+ AWS_DEFAULT_TAGS = [
33
+ {
34
+ "tags": {
35
+ "app": "app-sre-infra",
36
+ }
37
+ }
38
+ ]
39
+
31
40
 
32
41
  class ObjectFactory(Generic[T]):
33
42
  def __init__(self) -> None:
@@ -102,6 +111,8 @@ class AWSExternalResourceFactory(ExternalResourceFactory):
102
111
  def create_external_resource(self, spec: ExternalResourceSpec) -> ExternalResource:
103
112
  f = self.resource_factories.get_factory(spec.provider)
104
113
  data = f.resolve(spec)
114
+ data["tags"] = spec.tags(integration=QONTRACT_INTEGRATION)
115
+ data["default_tags"] = AWS_DEFAULT_TAGS
105
116
 
106
117
  region = data.get("region")
107
118
  if region:
@@ -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: