qontract-reconcile 0.10.1rc963__py3-none-any.whl → 0.10.1rc966__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.1rc963
3
+ Version: 0.10.1rc966
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
@@ -448,14 +448,14 @@ reconcile/skupper_network/models.py,sha256=HEwlVKsbmMaKaaBGvITIiSYNEVdjwXVhLaOJg
448
448
  reconcile/skupper_network/reconciler.py,sha256=XS-1oKBr_1l3dYUAVqUH6gCHg1G5ZuOfY_7fgGVAiFA,9996
449
449
  reconcile/skupper_network/site_controller.py,sha256=A3K-62BjJ5HiFVydV0ouGoD1NwrO7XhAH15BHAcS9fk,1550
450
450
  reconcile/statuspage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
451
- reconcile/statuspage/atlassian.py,sha256=G43HG5Y9FdYu_oEG9-yRpSwH4d2UtAqL26mrarWsN94,18515
451
+ reconcile/statuspage/atlassian.py,sha256=41uE77ZeV0M98k_xVmrXUQ33iVG8Lb3TwrWq2pRc84U,18617
452
452
  reconcile/statuspage/integration.py,sha256=hsazrQMceJbr61nEkJLxJbHhudTGtFuH0mlCo66-2ug,711
453
- reconcile/statuspage/page.py,sha256=tMXVnajU0r5V5_KGp3cL04eMLiDD2Kf4sIkao-L5puM,5217
453
+ reconcile/statuspage/page.py,sha256=k2CeosPG3EhTMSD_OFGm7AfDNX7zqWiibhraYqIIklg,5257
454
454
  reconcile/statuspage/state.py,sha256=wjX9by5Yy7nobxiE-xNhf6GyNwMVATd0O37jBckJm5M,1591
455
455
  reconcile/statuspage/status.py,sha256=ZKagwWqv-_Xsr97cQGCkbtd2U7ipA_iPKdnoj6Z-Jpw,2777
456
456
  reconcile/statuspage/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
457
457
  reconcile/statuspage/integrations/components.py,sha256=49KHd_E9AdRvcEA6n75q1McZv2LfN-hRsW-WA7dgw9g,2651
458
- reconcile/statuspage/integrations/maintenances.py,sha256=gL8mn1SbCNMveoD0nmqc5b_gS9XxPsqLtqBxJeRAvbY,4202
458
+ reconcile/statuspage/integrations/maintenances.py,sha256=lLhiVlSrVZONUxM8Cen-HJg1LcVILLGc1TaqjBhTuBc,4178
459
459
  reconcile/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
460
460
  reconcile/templates/aws_access_key_email.j2,sha256=2MUr1ERmyISzKgHqsWYLd-1Wbl-peUa-FsGUS-JLUFc,238
461
461
  reconcile/templates/email.yml.j2,sha256=OZgczNRgXPj2gVYTgwQyHAQrMGu7xp-e4W1rX19GcrU,690
@@ -742,8 +742,8 @@ reconcile/utils/internal_groups/client.py,sha256=RL-fNDtMGfpD7pNjCEmrj_0PV3ClCtU
742
742
  reconcile/utils/internal_groups/models.py,sha256=y_IqBVqfGqNXiu0VudvBWFrm_-uafVm5KgLG-ca8XAs,2281
743
743
  reconcile/utils/jinja2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
744
744
  reconcile/utils/jinja2/extensions.py,sha256=7K-uo6G2eCWa98MHT8fRPYIKCLQB_5D2keqQ_LyAfHM,1293
745
- reconcile/utils/jinja2/filters.py,sha256=RVVkpf87FllrPUpqk_8KN-r1IsmnS0bpygAVvsvIr5g,4504
746
- reconcile/utils/jinja2/utils.py,sha256=nyTS7SafbjQliIg0PZhqK0YGfFL0W2V6XA5CRaqOkrA,7809
745
+ reconcile/utils/jinja2/filters.py,sha256=tmiaYMhji5fv4B66YtR7zc-mE3wQLyj5I5SeX0WA2l4,4754
746
+ reconcile/utils/jinja2/utils.py,sha256=W_LMB2KiGuwIo04GUNK7jKCpmhKy6wGOH1jgshzXBU0,8004
747
747
  reconcile/utils/jobcontroller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
748
748
  reconcile/utils/jobcontroller/controller.py,sha256=2V_vm5thFx6adW4bMy9CdHXFesuo6S4lSkEpGxkXSM0,14492
749
749
  reconcile/utils/jobcontroller/models.py,sha256=tSRAkUX23iyn4YPsWEicFXwRxw3mXb5B2pDOWmXX8wQ,6350
@@ -847,8 +847,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
847
847
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
848
848
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
849
849
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
850
- qontract_reconcile-0.10.1rc963.dist-info/METADATA,sha256=AiGv3ClIB_-Pa6p12xqAjUMwkIZruqlZxurmniRlQas,2262
851
- qontract_reconcile-0.10.1rc963.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
852
- qontract_reconcile-0.10.1rc963.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
853
- qontract_reconcile-0.10.1rc963.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
854
- qontract_reconcile-0.10.1rc963.dist-info/RECORD,,
850
+ qontract_reconcile-0.10.1rc966.dist-info/METADATA,sha256=R3U88Yv6EwtlDutM0OWh4zUzHfGn0dkFdZZITdlhX2Q,2262
851
+ qontract_reconcile-0.10.1rc966.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
852
+ qontract_reconcile-0.10.1rc966.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
853
+ qontract_reconcile-0.10.1rc966.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
854
+ qontract_reconcile-0.10.1rc966.dist-info/RECORD,,
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import time
3
+ from datetime import datetime
3
4
  from typing import (
4
5
  Any,
5
6
  Self,
@@ -414,8 +415,8 @@ class AtlassianStatusPageProvider:
414
415
  return StatusMaintenance(
415
416
  name=name_override or raw_maintenance.name,
416
417
  message=raw_maintenance.incident_updates[0].body,
417
- schedule_start=raw_maintenance.scheduled_for,
418
- schedule_end=raw_maintenance.scheduled_until,
418
+ schedule_start=datetime.fromisoformat(raw_maintenance.scheduled_for),
419
+ schedule_end=datetime.fromisoformat(raw_maintenance.scheduled_until),
419
420
  components=[
420
421
  self._raw_component_to_status_component(c)
421
422
  for c in raw_maintenance.components
@@ -470,8 +471,8 @@ class AtlassianStatusPageProvider:
470
471
  data = {
471
472
  "name": maintenance.name,
472
473
  "status": "scheduled",
473
- "scheduled_for": maintenance.schedule_start,
474
- "scheduled_until": maintenance.schedule_end,
474
+ "scheduled_for": maintenance.schedule_start.isoformat(),
475
+ "scheduled_until": maintenance.schedule_end.isoformat(),
475
476
  "body": maintenance.message,
476
477
  "scheduled_remind_prior": maintenance.announcements.remind_subscribers,
477
478
  "scheduled_auto_transition": True,
@@ -55,7 +55,7 @@ class StatusPageMaintenancesIntegration(QontractReconcileIntegration[NoParams]):
55
55
  now = datetime.now(UTC)
56
56
  slack = slackapi_from_queries(QONTRACT_INTEGRATION, init_usergroups=False)
57
57
  for m in desired_state:
58
- scheduled_start = datetime.fromisoformat(m.schedule_start)
58
+ scheduled_start = m.schedule_start
59
59
  if now <= scheduled_start <= now + timedelta(hours=1):
60
60
  state_key = f"notifications/{m.name}"
61
61
  if binding_state.state.exists(state_key):
@@ -1,3 +1,4 @@
1
+ from datetime import datetime
1
2
  from typing import Self, cast
2
3
 
3
4
  from pydantic import BaseModel
@@ -128,8 +129,8 @@ class StatusMaintenance(BaseModel):
128
129
 
129
130
  name: str
130
131
  message: str
131
- schedule_start: str
132
- schedule_end: str
132
+ schedule_start: datetime
133
+ schedule_end: datetime
133
134
  components: list[StatusComponent]
134
135
  announcements: StatusMaintenanceAnnouncement
135
136
 
@@ -6,6 +6,7 @@ from typing import Any
6
6
  from urllib import parse
7
7
 
8
8
  import jinja2
9
+ import yaml
9
10
 
10
11
  from reconcile.utils.jsonpath import parse_jsonpath
11
12
 
@@ -20,6 +21,15 @@ def json_to_dict(input: str) -> Any:
20
21
  return data
21
22
 
22
23
 
24
+ def yaml_to_dict(input: str) -> Any:
25
+ """Jinja2 filter to parse YAML strings into dictionaries.
26
+ :param input: yaml string
27
+ :return: dict with the parsed inputs contents
28
+ """
29
+ data = yaml.safe_load(input)
30
+ return data
31
+
32
+
23
33
  def urlescape(string: str, safe: str = "/", encoding: str | None = None) -> str:
24
34
  """Jinja2 filter that is a simple wrapper around urllib's URL quoting
25
35
  functions that takes a string value and makes it safe for use as URL
@@ -1,3 +1,4 @@
1
+ import datetime
1
2
  from functools import cache
2
3
  from typing import Any, Self
3
4
 
@@ -22,6 +23,7 @@ from reconcile.utils.jinja2.filters import (
22
23
  matches_jsonpath,
23
24
  urlescape,
24
25
  urlunescape,
26
+ yaml_to_dict,
25
27
  )
26
28
  from reconcile.utils.secret_reader import SecretNotFound, SecretReader, SecretReaderBase
27
29
  from reconcile.utils.vault import SecretFieldNotFound
@@ -80,6 +82,7 @@ def compile_jinja2_template(
80
82
  )
81
83
  jinja_env.filters.update({
82
84
  "json_to_dict": json_to_dict,
85
+ "yaml_to_dict": yaml_to_dict,
83
86
  "urlescape": urlescape,
84
87
  "urlunescape": urlunescape,
85
88
  "eval": eval_filter,
@@ -212,6 +215,9 @@ def process_jinja2_template(
212
215
  "url": url_makes_sense,
213
216
  "s3": lookup_s3_object,
214
217
  "flatten_dict": flatten,
218
+ "yesterday": lambda: (datetime.datetime.now() - datetime.timedelta(1)).strftime(
219
+ "%Y-%m-%d"
220
+ ),
215
221
  })
216
222
  if "_template_mocks" in vars:
217
223
  for k, v in vars["_template_mocks"].items():