qontract-reconcile 0.10.2.dev276__py3-none-any.whl → 0.10.2.dev278__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev276
3
+ Version: 0.10.2.dev278
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -82,10 +82,10 @@ reconcile/openshift_tekton_resources.py,sha256=z9OidaI7Ju2O0O0PfIcdoyH62VA4TxLTD
82
82
  reconcile/openshift_upgrade_watcher.py,sha256=dGTQQdCOl95Bz0wOqg6JaMdBSSDgnAveH_hprUafhW0,6624
83
83
  reconcile/openshift_users.py,sha256=h4dH3gTCFFQID76PFuYeMWNzFQ9DgTUtsOcvxfj-3cs,5385
84
84
  reconcile/openshift_vault_secrets.py,sha256=Ax-_EBWWU1VRHYyKaUkGJkIjHGwWM3bZgjXL5CkPW8k,1883
85
- reconcile/quay_base.py,sha256=h5xNjb7EZm8L2JgpO42r6w0UA4im5dabZXJSIW69zKU,1987
86
- reconcile/quay_membership.py,sha256=1ajUJwPPudN7zmMZp81EipYljD0hAxzowaL-RbcroVA,6382
85
+ reconcile/quay_base.py,sha256=GQkUpuEzC1V_QrHEu_PoELVGnlNRvgFnTqVKp-xkgC4,2070
86
+ reconcile/quay_membership.py,sha256=No2sgEyTVj-hr5VPLy_xdrYAPvt-xo-CPpOt0X3x_6o,6623
87
87
  reconcile/quay_mirror.py,sha256=PBooiA0ShZpWYfO6oeKFqYYT6Syi7Q8JJD9kj0wRRLg,14030
88
- reconcile/quay_mirror_org.py,sha256=I-tEqRHLL6uFqbSi7qCfPuDNoae7EAI2U68NbDOhmv8,10809
88
+ reconcile/quay_mirror_org.py,sha256=PG_WpzE4TymICs74mFt3lh7XA4Rg91y4EVREMEd8PFk,10815
89
89
  reconcile/quay_permissions.py,sha256=9KOutS1w4RFQqkvMSy54VtsKNx56-phzP6yI_rEW-B8,4244
90
90
  reconcile/quay_repos.py,sha256=cuEYG0HUe0ut5yvLdEwOF5-CmccpXQHRb_wDazvDrvQ,6895
91
91
  reconcile/queries.py,sha256=aaffpfMIlmHy73CUxos--NnUsTR5ms3VPeaUY3dnvIs,49879
@@ -797,7 +797,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
797
797
  tools/saas_promotion_state/saas_promotion_state.py,sha256=oF7C4hpIgyMTwTRm3Aun3cDCHIjVar65JoLp6NcJHlU,3909
798
798
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
799
799
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
800
- qontract_reconcile-0.10.2.dev276.dist-info/METADATA,sha256=bIueWyC4gOTAksJl4z6yu3760Sb6y22pScGwcwT-YCw,24501
801
- qontract_reconcile-0.10.2.dev276.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
802
- qontract_reconcile-0.10.2.dev276.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
803
- qontract_reconcile-0.10.2.dev276.dist-info/RECORD,,
800
+ qontract_reconcile-0.10.2.dev278.dist-info/METADATA,sha256=L0l-pOkoslND8UA8-rIGFKDtKTMVu3tRjgBQoFf_b48,24501
801
+ qontract_reconcile-0.10.2.dev278.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
802
+ qontract_reconcile-0.10.2.dev278.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
803
+ qontract_reconcile-0.10.2.dev278.dist-info/RECORD,,
reconcile/quay_base.py CHANGED
@@ -1,13 +1,15 @@
1
1
  from collections import namedtuple
2
+ from typing import Any
2
3
 
3
4
  from reconcile import queries
4
5
  from reconcile.utils.quay_api import QuayApi
5
6
  from reconcile.utils.secret_reader import SecretReader
6
7
 
7
8
  OrgKey = namedtuple("OrgKey", ["instance", "org_name"])
9
+ QuayApiStore = dict[OrgKey, dict[str, Any]]
8
10
 
9
11
 
10
- def get_quay_api_store():
12
+ def get_quay_api_store() -> QuayApiStore:
11
13
  """
12
14
  Returns a dictionary with a key for each Quay organization
13
15
  managed in app-interface.
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
  import sys
3
3
  from collections.abc import Sequence
4
+ from typing import Any
4
5
 
5
6
  from reconcile.gql_definitions.quay_membership import quay_membership
6
7
  from reconcile.gql_definitions.quay_membership.quay_membership import (
@@ -9,13 +10,14 @@ from reconcile.gql_definitions.quay_membership.quay_membership import (
9
10
  PermissionQuayOrgTeamV1,
10
11
  UserV1,
11
12
  )
12
- from reconcile.quay_base import get_quay_api_store
13
+ from reconcile.quay_base import QuayApiStore, get_quay_api_store
13
14
  from reconcile.status import ExitCodes
14
15
  from reconcile.utils import (
15
16
  expiration,
16
17
  gql,
17
18
  )
18
19
  from reconcile.utils.aggregated_list import (
20
+ Action,
19
21
  AggregatedDiffRunner,
20
22
  AggregatedList,
21
23
  RunnerError,
@@ -33,7 +35,7 @@ def get_permissions_for_quay_membership() -> list[PermissionQuayOrgTeamV1]:
33
35
  return [p for p in query_data.permissions if isinstance(p, PermissionQuayOrgTeamV1)]
34
36
 
35
37
 
36
- def process_permission(permission: PermissionQuayOrgTeamV1):
38
+ def process_permission(permission: PermissionQuayOrgTeamV1) -> dict[str, Any]:
37
39
  """Returns a new permission object with the right keys
38
40
 
39
41
  State needs these fields: service, org, team.
@@ -52,7 +54,7 @@ def process_permission(permission: PermissionQuayOrgTeamV1):
52
54
  }
53
55
 
54
56
 
55
- def fetch_current_state(quay_api_store):
57
+ def fetch_current_state(quay_api_store: QuayApiStore) -> AggregatedList:
56
58
  state = AggregatedList()
57
59
 
58
60
  for org_key, org_data in quay_api_store.items():
@@ -85,7 +87,7 @@ def get_usernames(users: Sequence[UserV1 | BotV1 | ExternalUserV1]) -> list[str]
85
87
  return [u.quay_username for u in users if u.quay_username]
86
88
 
87
89
 
88
- def fetch_desired_state():
90
+ def fetch_desired_state() -> AggregatedList:
89
91
  permissions = get_permissions_for_quay_membership()
90
92
  state = AggregatedList()
91
93
 
@@ -105,14 +107,14 @@ def fetch_desired_state():
105
107
 
106
108
 
107
109
  class RunnerAction:
108
- def __init__(self, dry_run, quay_api_store):
110
+ def __init__(self, dry_run: bool, quay_api_store: QuayApiStore):
109
111
  self.dry_run = dry_run
110
112
  self.quay_api_store = quay_api_store
111
113
 
112
- def add_to_team(self):
114
+ def add_to_team(self) -> Action:
113
115
  label = "add_to_team"
114
116
 
115
- def action(params, items):
117
+ def action(params: dict, items: list) -> bool:
116
118
  org = params["org"]
117
119
  team = params["team"]
118
120
 
@@ -134,7 +136,7 @@ class RunnerAction:
134
136
 
135
137
  return action
136
138
 
137
- def create_team(self):
139
+ def create_team(self) -> Action:
138
140
  """
139
141
  Create an empty team in Quay. This method avoids adding users to the
140
142
  new team. add_to_team() will handle updating the member list the
@@ -142,7 +144,7 @@ class RunnerAction:
142
144
  """
143
145
  label = "create_team"
144
146
 
145
- def action(params, items):
147
+ def action(params: dict, items: list) -> bool:
146
148
  org = params["org"]
147
149
  team = params["team"]
148
150
 
@@ -164,10 +166,10 @@ class RunnerAction:
164
166
 
165
167
  return action
166
168
 
167
- def del_from_team(self):
169
+ def del_from_team(self) -> Action:
168
170
  label = "del_from_team"
169
171
 
170
- def action(params, items):
172
+ def action(params: dict, items: list) -> bool:
171
173
  org = params["org"]
172
174
  team = params["team"]
173
175
 
@@ -185,7 +187,7 @@ class RunnerAction:
185
187
  return action
186
188
 
187
189
 
188
- def run(dry_run):
190
+ def run(dry_run: bool) -> None:
189
191
  quay_api_store = get_quay_api_store()
190
192
 
191
193
  current_state = fetch_current_state(quay_api_store)
@@ -290,7 +290,7 @@ class QuayMirrorOrg:
290
290
 
291
291
 
292
292
  def run(
293
- dry_run,
293
+ dry_run: bool,
294
294
  control_file_dir: str | None,
295
295
  compare_tags: bool | None,
296
296
  compare_tags_interval: int,