qontract-reconcile 0.10.1rc441__py3-none-any.whl → 0.10.1rc442__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.1rc441
3
+ Version: 0.10.1rc442
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
@@ -131,7 +131,7 @@ reconcile/aws_ami_cleanup/integration.py,sha256=IW95cpMj2P5ffs-AxsR_TDQCJnYFBhLI
131
131
  reconcile/aws_cloudwatch_log_retention/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
132
  reconcile/aws_cloudwatch_log_retention/integration.py,sha256=0UcSZIrGvnGY4m9fj87oejIolIP_qTxtJInpmW9jrQ0,7772
133
133
  reconcile/aws_version_sync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
- reconcile/aws_version_sync/integration.py,sha256=sddkW_XcHF8KMeqE23Mxl3yLrpUkqzv_ArP-EVXcwIU,11432
134
+ reconcile/aws_version_sync/integration.py,sha256=fCDtfI3Lpz1l5l6AwC9tTnoiMeY7yvFLR6l7twixFlE,12248
135
135
  reconcile/aws_version_sync/utils.py,sha256=sVv-48PKi2VITlqqvmpbjnFDOPeGqfKzgkpIszlmjL0,1708
136
136
  reconcile/aws_version_sync/merge_request_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
137
  reconcile/aws_version_sync/merge_request_manager/merge_request.py,sha256=FeNcQaory5AXNVuVk-jJxPwtI4uSoURgkTH3rXAb2cc,6198
@@ -554,7 +554,7 @@ reconcile/utils/quay_api.py,sha256=EuOegpb-7ntEjkKLFwM2Oo4Nw7SyFtmyl3sQ9aXMtrM,8
554
554
  reconcile/utils/raw_github_api.py,sha256=ZHC-SZuAyRe1zaMoOU7Krt1-zecDxENd9c_NzQYqK9g,2968
555
555
  reconcile/utils/repo_owners.py,sha256=j-pUjc9PuDzq7KpjNLpnhqfU8tUG4nj2WMhFp4ick7g,6629
556
556
  reconcile/utils/secret_reader.py,sha256=2DeYAAQFjUULEKlLw3UDAUoND6gbqvCh9uKPtlc-0us,10403
557
- reconcile/utils/semver_helper.py,sha256=4Rrkz9Cj9A6oHPVgA-nGj6MBoxlFT4eyxTcslWqow3I,771
557
+ reconcile/utils/semver_helper.py,sha256=dp86KxjlOc8LHzawMvbxRfZamv7KU7b2SVnZQL-Xg6U,1142
558
558
  reconcile/utils/sharding.py,sha256=gkYf0lD3IUKQPEmdRJZ70mdDT1c9qWjbdP7evRsUis4,839
559
559
  reconcile/utils/slack_api.py,sha256=fntPGTn4hHRiScEIZu9LDPwbKeNPe9bR2Rmef9c-GIM,15830
560
560
  reconcile/utils/smtp_client.py,sha256=gJNbBQJpAt5PX4t_TaeNHsXM8vt50bFgndml6yK2b5o,2800
@@ -646,8 +646,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=dmEcNwZltP1rd_4DbxIYakO
646
646
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
647
647
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
648
648
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
649
- qontract_reconcile-0.10.1rc441.dist-info/METADATA,sha256=Tp4NZpTAgE4BiPYcp0W9kXVyNBkJ150Bmua9tKIJP2c,2348
650
- qontract_reconcile-0.10.1rc441.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
651
- qontract_reconcile-0.10.1rc441.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
652
- qontract_reconcile-0.10.1rc441.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
653
- qontract_reconcile-0.10.1rc441.dist-info/RECORD,,
649
+ qontract_reconcile-0.10.1rc442.dist-info/METADATA,sha256=y-3WObgzBJvlIUo2w7yrbG2GOPcQ6FiJ7nLAJ7-dRPQ,2348
650
+ qontract_reconcile-0.10.1rc442.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
651
+ qontract_reconcile-0.10.1rc442.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
652
+ qontract_reconcile-0.10.1rc442.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
653
+ qontract_reconcile-0.10.1rc442.dist-info/RECORD,,
@@ -5,7 +5,11 @@ from collections.abc import (
5
5
  )
6
6
  from typing import Any
7
7
 
8
- from pydantic import BaseModel
8
+ import semver
9
+ from pydantic import (
10
+ BaseModel,
11
+ validator,
12
+ )
9
13
 
10
14
  from reconcile.aws_version_sync.merge_request_manager.merge_request import (
11
15
  Parser,
@@ -42,6 +46,7 @@ from reconcile.utils.runtime.integration import (
42
46
  PydanticRunParams,
43
47
  QontractReconcileIntegration,
44
48
  )
49
+ from reconcile.utils.semver_helper import parse_semver
45
50
  from reconcile.utils.unleash import get_feature_toggle_state
46
51
  from reconcile.utils.vcs import VCS
47
52
 
@@ -67,7 +72,10 @@ class ExternalResource(BaseModel):
67
72
  resource_provider: str
68
73
  resource_identifier: str
69
74
  resource_engine: str
70
- resource_engine_version: str
75
+ resource_engine_version: semver.VersionInfo
76
+
77
+ class Config:
78
+ arbitrary_types_allowed = True
71
79
 
72
80
  @property
73
81
  def key(self) -> tuple:
@@ -79,6 +87,14 @@ class ExternalResource(BaseModel):
79
87
  self.resource_engine,
80
88
  )
81
89
 
90
+ @validator("resource_engine_version", pre=True)
91
+ def parse_resource_engine_version( # pylint: disable=no-self-argument
92
+ cls, v: str | semver.VersionInfo
93
+ ) -> semver.VersionInfo:
94
+ if isinstance(v, semver.VersionInfo):
95
+ return v
96
+ return parse_semver(v, optional_minor_and_patch=True)
97
+
82
98
 
83
99
  AwsExternalResources = list[ExternalResource]
84
100
  AppInterfaceExternalResources = list[ExternalResource]
@@ -228,12 +244,18 @@ class AVSIntegration(QontractReconcileIntegration[AVSIntegrationParams]):
228
244
  current=external_resources_app_interface,
229
245
  desired=external_resources_aws,
230
246
  key=lambda r: r.key,
231
- equal=lambda r1, r2: r1.resource_engine_version
232
- == r2.resource_engine_version,
247
+ equal=lambda external_resources_app_interface, external_resources_aws: external_resources_app_interface.resource_engine_version
248
+ == external_resources_aws.resource_engine_version,
233
249
  )
234
250
  for diff_pair in diff.change.values():
235
251
  aws_resource = diff_pair.desired
236
252
  app_interface_resource = diff_pair.current
253
+ if (
254
+ aws_resource.resource_engine_version
255
+ <= app_interface_resource.resource_engine_version
256
+ ):
257
+ # do not downgrade the version
258
+ continue
237
259
  # make mypy happy
238
260
  assert app_interface_resource.namespace_file
239
261
  assert app_interface_resource.provisioner.path
@@ -7,7 +7,16 @@ def make_semver(major: int, minor: int, patch: int) -> str:
7
7
  return str(semver.VersionInfo(major=major, minor=minor, patch=patch))
8
8
 
9
9
 
10
- def parse_semver(version: str) -> semver.VersionInfo:
10
+ def parse_semver(
11
+ version: str, optional_minor_and_patch: bool = False
12
+ ) -> semver.VersionInfo:
13
+ if optional_minor_and_patch:
14
+ # semver3 supports optional minor and patch.
15
+ # until we upgrade to semver3, we support this by adding a default minor and/or patch
16
+ if "." not in version:
17
+ version = f"{version}.0.0"
18
+ elif version.count(".") == 1:
19
+ version = f"{version}.0"
11
20
  return semver.VersionInfo.parse(version)
12
21
 
13
22