qontract-reconcile 0.10.1rc924__py3-none-any.whl → 0.10.1rc926__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.
- {qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/RECORD +9 -9
- reconcile/gql_definitions/templating/template_collection.py +2 -2
- reconcile/templating/lib/merge_request_manager.py +1 -1
- reconcile/templating/lib/model.py +19 -1
- reconcile/templating/renderer.py +37 -39
- {qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc926
|
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
|
{qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/RECORD
RENAMED
@@ -366,7 +366,7 @@ reconcile/gql_definitions/status_board/status_board.py,sha256=vHEzncabujkqbjJ-ib
|
|
366
366
|
reconcile/gql_definitions/statuspage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
367
367
|
reconcile/gql_definitions/statuspage/statuspages.py,sha256=CTRzjiR9k41LqlkgyoNHwC2JERsoD_Run_aK7jw_Ono,5299
|
368
368
|
reconcile/gql_definitions/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
369
|
-
reconcile/gql_definitions/templating/template_collection.py,sha256=
|
369
|
+
reconcile/gql_definitions/templating/template_collection.py,sha256=I9razKZ9BThTn1HZW1AamwF0EKXxLACL30DxGxev-rA,4045
|
370
370
|
reconcile/gql_definitions/templating/templates.py,sha256=bV1JWwxDW8opARBOrZ_h5NBsJfM-9aL-povmTZnpTOk,3296
|
371
371
|
reconcile/gql_definitions/terraform_cloudflare_dns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
372
372
|
reconcile/gql_definitions/terraform_cloudflare_dns/app_interface_cloudflare_dns_settings.py,sha256=eyGX9HcTF6MZbOYZ6Kl6Mg3k6nJTUtwqs9gDxBP_8Dk,1920
|
@@ -463,11 +463,11 @@ reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9
|
|
463
463
|
reconcile/templates/rosa-classic-cluster-creation.sh.j2,sha256=FVBmnR2FmVModhqOYNBInhF8zk0Qnj9og9KHK5-X9v0,2361
|
464
464
|
reconcile/templates/rosa-hcp-cluster-creation.sh.j2,sha256=2wTdv9qvapCvT8NSi_hq8sXhpFSaxRX-V6Cao1diCI8,2393
|
465
465
|
reconcile/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
466
|
-
reconcile/templating/renderer.py,sha256=
|
466
|
+
reconcile/templating/renderer.py,sha256=4Uo0HHRhXyXQNCMAEv3MiSL_R_B_DQ3MD7wtYcDzL9w,12951
|
467
467
|
reconcile/templating/validator.py,sha256=5f9f35PCHOOdjb7KZquL2YdabyuAUokPDa4xutSEHIQ,5360
|
468
468
|
reconcile/templating/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
469
|
-
reconcile/templating/lib/merge_request_manager.py,sha256=
|
470
|
-
reconcile/templating/lib/model.py,sha256=
|
469
|
+
reconcile/templating/lib/merge_request_manager.py,sha256=P4IbblzXbubjlaxAYoahHFADUNIXLepfqwzdnHPs8OY,5608
|
470
|
+
reconcile/templating/lib/model.py,sha256=Y1PeEP-koHKiH46JSwv4-PGRGQtcxZa9VmjTiuI6Lxs,889
|
471
471
|
reconcile/templating/lib/rendering.py,sha256=6kt8NCCwB4vLKYal7KtRmBDguIC1p_PIQCRr-vL7p5w,5504
|
472
472
|
reconcile/terraform_init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
473
473
|
reconcile/terraform_init/integration.py,sha256=glQ9uy8Kj2aTQXCAupwSFeih7reX_xMX_UuWW_ywBMU,6100
|
@@ -844,8 +844,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
|
|
844
844
|
tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
|
845
845
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
846
846
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
847
|
-
qontract_reconcile-0.10.
|
848
|
-
qontract_reconcile-0.10.
|
849
|
-
qontract_reconcile-0.10.
|
850
|
-
qontract_reconcile-0.10.
|
851
|
-
qontract_reconcile-0.10.
|
847
|
+
qontract_reconcile-0.10.1rc926.dist-info/METADATA,sha256=eqpGD1LsAnd-3_U8CIfVPdBtlGf52mIqcTnfrhGHdFE,2273
|
848
|
+
qontract_reconcile-0.10.1rc926.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
849
|
+
qontract_reconcile-0.10.1rc926.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
850
|
+
qontract_reconcile-0.10.1rc926.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
851
|
+
qontract_reconcile-0.10.1rc926.dist-info/RECORD,,
|
@@ -19,8 +19,8 @@ from pydantic import ( # noqa: F401 # pylint: disable=W0611
|
|
19
19
|
|
20
20
|
|
21
21
|
DEFINITION = """
|
22
|
-
query TemplateCollection_v1 {
|
23
|
-
template_collection_v1 {
|
22
|
+
query TemplateCollection_v1($name: String) {
|
23
|
+
template_collection_v1(name: $name) {
|
24
24
|
name
|
25
25
|
additionalMrLabels
|
26
26
|
description
|
@@ -136,7 +136,7 @@ class MergeRequestManager(MergeRequestManagerBase[TemplateInfo]):
|
|
136
136
|
|
137
137
|
output = data.data
|
138
138
|
collections = {o.input.collection for o in output}
|
139
|
-
collection_hashes = {o.input.
|
139
|
+
collection_hashes = {o.input.calc_template_hash() for o in output}
|
140
140
|
additional_labels = {label for o in output for label in o.input.labels}
|
141
141
|
# From the way the code is written, we can assert that there is only one collection and one template hash
|
142
142
|
assert len(collections) == 1
|
@@ -1,12 +1,30 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
from deepdiff import DeepHash
|
1
4
|
from pydantic import BaseModel
|
2
5
|
|
6
|
+
from reconcile.gql_definitions.templating.template_collection import (
|
7
|
+
TemplateV1,
|
8
|
+
)
|
9
|
+
|
3
10
|
|
4
11
|
class TemplateInput(BaseModel):
|
5
12
|
collection: str
|
6
|
-
|
13
|
+
templates: list[TemplateV1] = []
|
14
|
+
variables: list[dict[str, Any]] = []
|
15
|
+
collection_hash: str = ""
|
7
16
|
enable_auto_approval: bool = False
|
8
17
|
labels: list[str] = []
|
9
18
|
|
19
|
+
def calc_template_hash(self) -> str:
|
20
|
+
if not self.collection_hash:
|
21
|
+
hashable = {
|
22
|
+
"templates": sorted(self.templates, key=lambda x: x.name),
|
23
|
+
"variables": self.variables,
|
24
|
+
}
|
25
|
+
self.collection_hash = DeepHash(hashable)[hashable]
|
26
|
+
return self.collection_hash
|
27
|
+
|
10
28
|
|
11
29
|
class TemplateOutput(BaseModel):
|
12
30
|
input: TemplateInput
|
reconcile/templating/renderer.py
CHANGED
@@ -7,7 +7,6 @@ from collections.abc import Callable
|
|
7
7
|
from pathlib import Path
|
8
8
|
from typing import Any, Self
|
9
9
|
|
10
|
-
from deepdiff import DeepHash
|
11
10
|
from ruamel import yaml
|
12
11
|
|
13
12
|
from reconcile.gql_definitions.templating.template_collection import (
|
@@ -48,11 +47,11 @@ APP_INTERFACE_PATH_SEPERATOR = "/"
|
|
48
47
|
|
49
48
|
|
50
49
|
def get_template_collections(
|
51
|
-
query_func: Callable | None = None,
|
50
|
+
query_func: Callable | None = None, name: str | None = None
|
52
51
|
) -> list[TemplateCollectionV1]:
|
53
|
-
variables
|
54
|
-
if
|
55
|
-
variables["
|
52
|
+
variables = {}
|
53
|
+
if name:
|
54
|
+
variables["name"] = name
|
56
55
|
if not query_func:
|
57
56
|
query_func = gql.get_api().query
|
58
57
|
return query(query_func, variables=variables).template_collection_v1 or []
|
@@ -187,14 +186,6 @@ def unpack_dynamic_variables(
|
|
187
186
|
return dynamic
|
188
187
|
|
189
188
|
|
190
|
-
def calc_template_hash(c: TemplateCollectionV1, variables: dict[str, Any]) -> str:
|
191
|
-
hashable = {
|
192
|
-
"templates": sorted(c.templates, key=lambda x: x.name),
|
193
|
-
"variables": variables,
|
194
|
-
}
|
195
|
-
return DeepHash(hashable)[hashable]
|
196
|
-
|
197
|
-
|
198
189
|
class TemplateRendererIntegrationParams(PydanticRunParams):
|
199
190
|
clone_repo: bool = False
|
200
191
|
app_interface_data_path: str | None
|
@@ -276,11 +267,11 @@ class TemplateRendererIntegration(QontractReconcileIntegration):
|
|
276
267
|
self,
|
277
268
|
collection: TemplateCollectionV1,
|
278
269
|
gql_api: GqlApi,
|
279
|
-
dry_run: bool,
|
280
270
|
persistence: FilePersistence,
|
281
271
|
ruamel_instance: yaml.YAML,
|
272
|
+
input: TemplateInput,
|
282
273
|
each: dict[str, Any],
|
283
|
-
) ->
|
274
|
+
) -> list[TemplateOutput]:
|
284
275
|
variables = {}
|
285
276
|
if collection.variables:
|
286
277
|
variables = {
|
@@ -289,20 +280,17 @@ class TemplateRendererIntegration(QontractReconcileIntegration):
|
|
289
280
|
),
|
290
281
|
"static": unpack_static_variables(collection.variables, each),
|
291
282
|
}
|
283
|
+
input.variables.append(variables)
|
292
284
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
enable_auto_approval=collection.enable_auto_approval or False,
|
298
|
-
labels=collection.additional_mr_labels or [],
|
285
|
+
outputs: list[TemplateOutput] = []
|
286
|
+
for template in collection.templates:
|
287
|
+
output = self.process_template(
|
288
|
+
template, variables, persistence, ruamel_instance, input
|
299
289
|
)
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
if not dry_run and output:
|
305
|
-
p.write([output])
|
290
|
+
if output:
|
291
|
+
outputs.append(output)
|
292
|
+
|
293
|
+
return outputs
|
306
294
|
|
307
295
|
def reconcile(
|
308
296
|
self,
|
@@ -311,21 +299,31 @@ class TemplateRendererIntegration(QontractReconcileIntegration):
|
|
311
299
|
ruamel_instance: yaml.YAML,
|
312
300
|
) -> None:
|
313
301
|
gql_no_validation = init_from_config(validate_schemas=False)
|
314
|
-
for c in get_template_collections(
|
315
|
-
template_collection_name=self.params.template_collection_name
|
316
|
-
):
|
302
|
+
for c in get_template_collections(name=self.params.template_collection_name):
|
317
303
|
for_each_items: list[dict[str, Any]] = [{}]
|
318
304
|
if c.for_each and c.for_each.items:
|
319
305
|
for_each_items = c.for_each.items
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
306
|
+
input = TemplateInput(
|
307
|
+
collection=c.name,
|
308
|
+
templates=c.templates,
|
309
|
+
enable_auto_approval=c.enable_auto_approval or False,
|
310
|
+
labels=c.additional_mr_labels or [],
|
311
|
+
)
|
312
|
+
with PersistenceTransaction(persistence, dry_run) as p:
|
313
|
+
outputs: list[TemplateOutput] = []
|
314
|
+
for item in for_each_items:
|
315
|
+
outputs.extend(
|
316
|
+
self.reconcile_template_collection(
|
317
|
+
c,
|
318
|
+
gql_no_validation,
|
319
|
+
p,
|
320
|
+
ruamel_instance,
|
321
|
+
input,
|
322
|
+
item,
|
323
|
+
)
|
324
|
+
)
|
325
|
+
if not dry_run and outputs:
|
326
|
+
p.write(outputs)
|
329
327
|
|
330
328
|
@property
|
331
329
|
def name(self) -> str:
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc924.dist-info → qontract_reconcile-0.10.1rc926.dist-info}/top_level.txt
RENAMED
File without changes
|