qontract-reconcile 0.10.1rc594__py3-none-any.whl → 0.10.1rc596__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.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/RECORD +9 -9
- reconcile/templating/renderer.py +2 -1
- reconcile/templating/rendering.py +24 -8
- reconcile/templating/validator.py +1 -1
- reconcile/utils/jinja2/utils.py +3 -0
- {qontract_reconcile-0.10.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc594.dist-info → qontract_reconcile-0.10.1rc596.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.1rc596
|
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.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/RECORD
RENAMED
@@ -387,9 +387,9 @@ reconcile/templates/aws_access_key_email.j2,sha256=2MUr1ERmyISzKgHqsWYLd-1Wbl-pe
|
|
387
387
|
reconcile/templates/email.yml.j2,sha256=OZgczNRgXPj2gVYTgwQyHAQrMGu7xp-e4W1rX19GcrU,690
|
388
388
|
reconcile/templates/jira-checkpoint-missinginfo.j2,sha256=c_Vvg-lEENsB3tgxm9B6Y9igCUQhCnFDYh6xw-zcIbU,570
|
389
389
|
reconcile/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
390
|
-
reconcile/templating/renderer.py,sha256=
|
391
|
-
reconcile/templating/rendering.py,sha256=
|
392
|
-
reconcile/templating/validator.py,sha256=
|
390
|
+
reconcile/templating/renderer.py,sha256=3wQrVFbm1gdF6Wb1NfCjaXzJ9tTIhFwZO8TlR90eUdc,5086
|
391
|
+
reconcile/templating/rendering.py,sha256=EWgtnnzjnMFxVkfL7qsvokIvoUhPnJxEr_goy5vgTMo,4526
|
392
|
+
reconcile/templating/validator.py,sha256=W64nR1eoKVDGewJ4DEX9ZiWWKjFEKg5w5Xi6lrrPBd8,3434
|
393
393
|
reconcile/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
394
394
|
reconcile/test/conftest.py,sha256=rQousYrxUz-EwAIbsYO6bIwR1B4CrOz9y_zaUVo2lfI,4466
|
395
395
|
reconcile/test/fixtures.py,sha256=9SDWAUlSd1rCx7z3GhULHcpr-I6FyCsXxaFAZIqYQsQ,591
|
@@ -624,7 +624,7 @@ reconcile/utils/internal_groups/models.py,sha256=jlkH_hyyyuwS0J1IpuS7W1AyQSKQ2Qp
|
|
624
624
|
reconcile/utils/jinja2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
625
625
|
reconcile/utils/jinja2/extensions.py,sha256=zV_x8MhSHAynKhFnG3fULXrwsm5fUG_88IygZHSnN0o,1284
|
626
626
|
reconcile/utils/jinja2/filters.py,sha256=_kJjdMsY3lGS5PUn4NnpXUQDNrL1IwiKsB-0MhTMGYM,4521
|
627
|
-
reconcile/utils/jinja2/utils.py,sha256=
|
627
|
+
reconcile/utils/jinja2/utils.py,sha256=1TV_BoKrCFxVPbRY4hhUmbasrPa_wm9AoabCEIOXRLg,5947
|
628
628
|
reconcile/utils/membershipsources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
629
629
|
reconcile/utils/membershipsources/app_interface_resolver.py,sha256=IlDiRtJZ0AfAGKEawybB6SvsKbm1POTXL6fpEt699E0,1979
|
630
630
|
reconcile/utils/membershipsources/models.py,sha256=IFu6KHFe-HUTJPiAO3fEw7i22yv4_ytgBW-h_wrO6V4,2015
|
@@ -693,8 +693,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
|
|
693
693
|
tools/test/test_qontract_cli.py,sha256=OvalpVRfY4pNmpMaWHHYqBjV68b1eGQjX8SCyTAXb1w,3501
|
694
694
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
695
695
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
696
|
-
qontract_reconcile-0.10.
|
697
|
-
qontract_reconcile-0.10.
|
698
|
-
qontract_reconcile-0.10.
|
699
|
-
qontract_reconcile-0.10.
|
700
|
-
qontract_reconcile-0.10.
|
696
|
+
qontract_reconcile-0.10.1rc596.dist-info/METADATA,sha256=48NeYqXGwOl1UWs78VYRsxQpABH6M_hfv5xHUEO3cFw,2349
|
697
|
+
qontract_reconcile-0.10.1rc596.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
698
|
+
qontract_reconcile-0.10.1rc596.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
|
699
|
+
qontract_reconcile-0.10.1rc596.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
700
|
+
qontract_reconcile-0.10.1rc596.dist-info/RECORD,,
|
reconcile/templating/renderer.py
CHANGED
@@ -108,8 +108,8 @@ class TemplateRendererIntegration(QontractReconcileIntegration):
|
|
108
108
|
def __init__(self, params: TemplateRendererIntegrationParams) -> None:
|
109
109
|
super().__init__(params)
|
110
110
|
|
111
|
-
@staticmethod
|
112
111
|
def process_template(
|
112
|
+
self,
|
113
113
|
template: TemplateV1,
|
114
114
|
variables: dict,
|
115
115
|
persistence: FilePersistence,
|
@@ -120,6 +120,7 @@ class TemplateRendererIntegration(QontractReconcileIntegration):
|
|
120
120
|
TemplateData(
|
121
121
|
variables=variables,
|
122
122
|
),
|
123
|
+
secret_reader=self.secret_reader,
|
123
124
|
)
|
124
125
|
target_path = r.render_target_path()
|
125
126
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
2
|
from typing import Any, Optional, Protocol
|
3
3
|
|
4
|
-
from jinja2.sandbox import SandboxedEnvironment
|
5
4
|
from pydantic import BaseModel
|
6
5
|
from ruamel import yaml
|
7
6
|
|
7
|
+
from reconcile.utils.jinja2.utils import process_jinja2_template
|
8
8
|
from reconcile.utils.jsonpath import parse_jsonpath
|
9
|
+
from reconcile.utils.secret_reader import SecretReaderBase
|
9
10
|
|
10
11
|
|
11
12
|
class TemplateData(BaseModel):
|
@@ -34,17 +35,24 @@ class Template(Protocol):
|
|
34
35
|
|
35
36
|
|
36
37
|
class Renderer(ABC):
|
37
|
-
def __init__(
|
38
|
+
def __init__(
|
39
|
+
self,
|
40
|
+
template: Template,
|
41
|
+
data: TemplateData,
|
42
|
+
secret_reader: SecretReaderBase,
|
43
|
+
):
|
38
44
|
self.template = template
|
39
45
|
self.data = data
|
40
|
-
self.
|
46
|
+
self.secret_reader = secret_reader
|
41
47
|
|
42
48
|
def _jinja2_render_kwargs(self) -> dict[str, Any]:
|
43
49
|
return {**self.data.variables, "current": self.data.current}
|
44
50
|
|
45
51
|
def _render_template(self, template: str) -> str:
|
46
|
-
return
|
47
|
-
|
52
|
+
return process_jinja2_template(
|
53
|
+
body=template,
|
54
|
+
vars=self._jinja2_render_kwargs(),
|
55
|
+
secret_reader=self.secret_reader,
|
48
56
|
)
|
49
57
|
|
50
58
|
@abstractmethod
|
@@ -126,7 +134,15 @@ class PatchRenderer(Renderer):
|
|
126
134
|
return yaml.dump(self.data.current, width=4096, Dumper=yaml.RoundTripDumper)
|
127
135
|
|
128
136
|
|
129
|
-
def create_renderer(
|
137
|
+
def create_renderer(
|
138
|
+
template: Template,
|
139
|
+
data: TemplateData,
|
140
|
+
secret_reader: SecretReaderBase,
|
141
|
+
) -> Renderer:
|
130
142
|
if template.patch:
|
131
|
-
return PatchRenderer(template=template, data=data)
|
132
|
-
return FullRenderer(
|
143
|
+
return PatchRenderer(template=template, data=data, secret_reader=secret_reader)
|
144
|
+
return FullRenderer(
|
145
|
+
template=template,
|
146
|
+
data=data,
|
147
|
+
secret_reader=secret_reader,
|
148
|
+
)
|
@@ -52,7 +52,6 @@ class TemplateValidatorIntegration(QontractReconcileIntegration):
|
|
52
52
|
for template in get_templates():
|
53
53
|
for test in template.template_test:
|
54
54
|
logging.info(f"Running test {test.name} for template {template.name}")
|
55
|
-
|
56
55
|
r = create_renderer(
|
57
56
|
template,
|
58
57
|
TemplateData(
|
@@ -61,6 +60,7 @@ class TemplateValidatorIntegration(QontractReconcileIntegration):
|
|
61
60
|
test.current or "", Loader=yaml.RoundTripLoader
|
62
61
|
),
|
63
62
|
),
|
63
|
+
secret_reader=self.secret_reader,
|
64
64
|
)
|
65
65
|
if test.expected_target_path:
|
66
66
|
self.diff_result(
|
reconcile/utils/jinja2/utils.py
CHANGED
@@ -157,6 +157,9 @@ def process_jinja2_template(
|
|
157
157
|
"query": lookup_graphql_query_results,
|
158
158
|
"url": url_makes_sense,
|
159
159
|
})
|
160
|
+
if "_template_mocks" in vars:
|
161
|
+
for k, v in vars["_template_mocks"].items():
|
162
|
+
vars[k] = lambda *args, **kwargs: v
|
160
163
|
try:
|
161
164
|
template = compile_jinja2_template(body, extra_curly)
|
162
165
|
r = template.render(vars)
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc594.dist-info → qontract_reconcile-0.10.1rc596.dist-info}/top_level.txt
RENAMED
File without changes
|