qontract-reconcile 0.10.2.dev311__py3-none-any.whl → 0.10.2.dev313__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.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/RECORD +8 -8
- reconcile/prometheus_rules_tester/integration.py +1 -1
- reconcile/terraform_tgw_attachments.py +1 -1
- reconcile/terraform_users.py +1 -2
- reconcile/utils/terraform_client.py +24 -22
- {qontract_reconcile-0.10.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.2.
|
3
|
+
Version: 0.10.2.dev313
|
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
|
{qontract_reconcile-0.10.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/RECORD
RENAMED
@@ -109,8 +109,8 @@ reconcile/terraform_cloudflare_resources.py,sha256=tK-BxQeNdZjf59deKd51Roz868e7U
|
|
109
109
|
reconcile/terraform_cloudflare_users.py,sha256=mlSYNktRetBvw8mi2TUSdKSZw0aQ821VeU6OQ1WcV3U,13516
|
110
110
|
reconcile/terraform_repo.py,sha256=vVJfaCV9775FGMMTHfoobaPetSlJMiQ4arNudL2pvh8,15607
|
111
111
|
reconcile/terraform_resources.py,sha256=AXO3_Ehcg3I6ao7qiKzXC4Mk6BqwMoNooXU50c2zSTA,19555
|
112
|
-
reconcile/terraform_tgw_attachments.py,sha256=
|
113
|
-
reconcile/terraform_users.py,sha256=
|
112
|
+
reconcile/terraform_tgw_attachments.py,sha256=P2HivCjT5AlyODy-fu1qAK5355nDEArE8E4NQlIlF7U,18933
|
113
|
+
reconcile/terraform_users.py,sha256=lzLco8t0_XQ4gWkZdvfOJIckDQpDUqTKqxGcT2P3W_k,10334
|
114
114
|
reconcile/terraform_vpc_peerings.py,sha256=rMotDHy3Fd5QTxrOGjCJ3f2vICk3fmxrKYVCIU8p_y4,27787
|
115
115
|
reconcile/vault_replication.py,sha256=trtbB-jDwca822J5I_s0zlwFtlyaiAtqgbPeqp7Cggc,17714
|
116
116
|
reconcile/vpc_peerings_validator.py,sha256=_77eu6DSy6VjTE5mhV-sOIVOGIiBvDEEDCdwwRdrgVQ,7101
|
@@ -456,7 +456,7 @@ reconcile/oum/models.py,sha256=teH0bJTCMTzbdbYD9CU4yXDuMr34ceLcM0KuoIPU8gI,1712
|
|
456
456
|
reconcile/oum/providers.py,sha256=lfG6d7YV-A4Lte45EMv1Gx4A346piJ_jAkrU5AHJZ_g,1834
|
457
457
|
reconcile/oum/standalone.py,sha256=EN5y1S-3DwUZYzSRqRMtf63mI2slvBHKiU9zOTjYvWM,7334
|
458
458
|
reconcile/prometheus_rules_tester/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
459
|
-
reconcile/prometheus_rules_tester/integration.py,sha256=
|
459
|
+
reconcile/prometheus_rules_tester/integration.py,sha256=qa1OrD1gCR1PUrHNFc2AL3J01SdBYfMOX8fHcOUh1T8,9618
|
460
460
|
reconcile/rhidp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
461
461
|
reconcile/rhidp/common.py,sha256=MIOzjObdvDtZuLvrYBp2GhvPfRp6p-Lohbr_hgEsNYM,7025
|
462
462
|
reconcile/rhidp/metrics.py,sha256=Yp0GtpjhieEdru0qkG3osBTJiKUzg6CAjwPoFTQDnCg,417
|
@@ -657,7 +657,7 @@ reconcile/utils/smtp_client.py,sha256=0xefB4I9E5eBB-FlxFJYjvz3Kvuqi_K3Ma_Wk0NAQK
|
|
657
657
|
reconcile/utils/sqs_gateway.py,sha256=XNIf3PY4UCPNufP2Ul0UJj3fKlt5larBba-VTT-41Fg,2265
|
658
658
|
reconcile/utils/state.py,sha256=vCHYIfrWLfPyIWEHSaADWlc4OqhwcOiqM3Egqvw-lfo,16372
|
659
659
|
reconcile/utils/structs.py,sha256=P57POzpEntu8ZoZDnsOdni9qUuBDWknmw0iinznxXoY,386
|
660
|
-
reconcile/utils/terraform_client.py,sha256=
|
660
|
+
reconcile/utils/terraform_client.py,sha256=zF_F31WzDA3fjNPj_Jl6mQJMfI3wEQ0gsurtrjqh4Ds,37684
|
661
661
|
reconcile/utils/terrascript_aws_client.py,sha256=KxraVMhv_RcolHthAxucQeb3x0zFD2CCk3gVMjQ_ero,302090
|
662
662
|
reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
|
663
663
|
reconcile/utils/throughput.py,sha256=KNDCVsCLSp89V4pO3sEUd7bJUuh6gNfsxsc_18rEv_Y,357
|
@@ -796,7 +796,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
796
796
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=uQv2QJAmUXP1g2GPIH30WTlvL9soY6m9lefpZEVDM5w,3965
|
797
797
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
798
798
|
tools/sre_checkpoints/util.py,sha256=KcYVfa3UmJHVP_ocgrKe8NkrO5IDB9aWEDydSokPcRk,975
|
799
|
-
qontract_reconcile-0.10.2.
|
800
|
-
qontract_reconcile-0.10.2.
|
801
|
-
qontract_reconcile-0.10.2.
|
802
|
-
qontract_reconcile-0.10.2.
|
799
|
+
qontract_reconcile-0.10.2.dev313.dist-info/METADATA,sha256=KkW-0QYSeRGwwEnif-BFzkzPEStcexb8mN-6NV7Na34,24916
|
800
|
+
qontract_reconcile-0.10.2.dev313.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
801
|
+
qontract_reconcile-0.10.2.dev313.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
802
|
+
qontract_reconcile-0.10.2.dev313.dist-info/RECORD,,
|
@@ -342,7 +342,7 @@ def _populate_tgw_attachments_working_dirs(
|
|
342
342
|
ts: Terrascript,
|
343
343
|
desired_state: Iterable[DesiredStateItem],
|
344
344
|
print_to_file: str | None,
|
345
|
-
) ->
|
345
|
+
) -> dict[str, str]:
|
346
346
|
accounts_by_infra_account_name: dict[str, list[dict[str, Any]]] = {}
|
347
347
|
for item in desired_state:
|
348
348
|
accounts_by_infra_account_name.setdefault(item.infra_acount_name, []).append(
|
reconcile/terraform_users.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import sys
|
2
|
-
from collections.abc import Mapping
|
3
2
|
from textwrap import indent
|
4
3
|
from typing import (
|
5
4
|
Any,
|
@@ -117,7 +116,7 @@ def setup(
|
|
117
116
|
skip_reencrypt_accounts: list[str],
|
118
117
|
appsre_pgp_key: str | None = None,
|
119
118
|
account_name: str | None = None,
|
120
|
-
) -> tuple[list[dict[str, Any]],
|
119
|
+
) -> tuple[list[dict[str, Any]], dict[str, str], bool, AWSApi]:
|
121
120
|
accounts = [
|
122
121
|
a
|
123
122
|
for a in queries.get_aws_accounts(terraform_state=True)
|
@@ -5,8 +5,8 @@ import shutil
|
|
5
5
|
import tempfile
|
6
6
|
from collections import defaultdict
|
7
7
|
from collections.abc import (
|
8
|
-
Generator,
|
9
8
|
Iterable,
|
9
|
+
Iterator,
|
10
10
|
Mapping,
|
11
11
|
)
|
12
12
|
from contextlib import contextmanager
|
@@ -86,8 +86,8 @@ class TerraformClient:
|
|
86
86
|
working_dirs: Mapping[str, str],
|
87
87
|
thread_pool_size: int,
|
88
88
|
aws_api: AWSApi | None = None,
|
89
|
-
init_users=False,
|
90
|
-
):
|
89
|
+
init_users: bool = False,
|
90
|
+
) -> None:
|
91
91
|
self.integration = integration
|
92
92
|
self.integration_version = integration_version
|
93
93
|
self.integration_prefix = integration_prefix
|
@@ -101,7 +101,7 @@ class TerraformClient:
|
|
101
101
|
|
102
102
|
self.specs: list[TerraformSpec] = []
|
103
103
|
self.init_specs()
|
104
|
-
self.outputs: dict = {}
|
104
|
+
self.outputs: dict[str, Any] = {}
|
105
105
|
self.init_outputs()
|
106
106
|
|
107
107
|
self.OUTPUT_TYPE_SECRETS = "Secrets"
|
@@ -112,19 +112,19 @@ class TerraformClient:
|
|
112
112
|
if init_users:
|
113
113
|
self.init_existing_users()
|
114
114
|
|
115
|
-
def init_existing_users(self):
|
115
|
+
def init_existing_users(self) -> None:
|
116
116
|
self.users = {
|
117
117
|
account: list(self.format_output(output, self.OUTPUT_TYPE_PASSWORDS).keys())
|
118
118
|
for account, output in self.outputs.items()
|
119
119
|
}
|
120
120
|
|
121
|
-
def increment_apply_count(self):
|
121
|
+
def increment_apply_count(self) -> None:
|
122
122
|
self.apply_count += 1
|
123
123
|
|
124
124
|
def should_apply(self) -> bool:
|
125
125
|
return self.apply_count > 0
|
126
126
|
|
127
|
-
def get_new_users(self):
|
127
|
+
def get_new_users(self) -> list[tuple[str, Any, str, Any]]:
|
128
128
|
new_users = []
|
129
129
|
self.init_outputs() # get updated output
|
130
130
|
for account, output in self.outputs.items():
|
@@ -141,7 +141,7 @@ class TerraformClient:
|
|
141
141
|
))
|
142
142
|
return new_users
|
143
143
|
|
144
|
-
def init_specs(self):
|
144
|
+
def init_specs(self) -> None:
|
145
145
|
self.specs = [
|
146
146
|
TerraformSpec(name=name, working_dir=wd)
|
147
147
|
for name, wd in self.working_dirs.items()
|
@@ -152,7 +152,7 @@ class TerraformClient:
|
|
152
152
|
@contextmanager
|
153
153
|
def _terraform_log_file(
|
154
154
|
self, working_dir: str
|
155
|
-
) ->
|
155
|
+
) -> Iterator[tuple[IO[bytes], dict[str, str]]]:
|
156
156
|
with tempfile.NamedTemporaryFile(dir=working_dir) as f:
|
157
157
|
env = {
|
158
158
|
"TF_LOG": TERRAFORM_LOG_LEVEL,
|
@@ -161,7 +161,7 @@ class TerraformClient:
|
|
161
161
|
yield f, env
|
162
162
|
|
163
163
|
@retry(exceptions=TerraformCommandError)
|
164
|
-
def terraform_init(self, spec: TerraformSpec):
|
164
|
+
def terraform_init(self, spec: TerraformSpec) -> None:
|
165
165
|
with self._terraform_log_file(spec.working_dir) as (f, env):
|
166
166
|
return_code, stdout, stderr = lean_tf.init(spec.working_dir, env=env)
|
167
167
|
log = f.read().decode("utf-8")
|
@@ -171,12 +171,12 @@ class TerraformClient:
|
|
171
171
|
return_code, "init", output=stdout, stderr=stderr
|
172
172
|
)
|
173
173
|
|
174
|
-
def init_outputs(self):
|
174
|
+
def init_outputs(self) -> None:
|
175
175
|
results = threaded.run(self.terraform_output, self.specs, self.thread_pool_size)
|
176
176
|
self.outputs = dict(results)
|
177
177
|
|
178
178
|
@retry(exceptions=TerraformCommandError)
|
179
|
-
def terraform_output(self, spec: TerraformSpec):
|
179
|
+
def terraform_output(self, spec: TerraformSpec) -> tuple[str, Any]:
|
180
180
|
with self._terraform_log_file(spec.working_dir) as (f, env):
|
181
181
|
return_code, stdout, stderr = lean_tf.output(spec.working_dir, env=env)
|
182
182
|
log = f.read().decode("utf-8")
|
@@ -278,7 +278,7 @@ class TerraformClient:
|
|
278
278
|
self,
|
279
279
|
spec: TerraformSpec,
|
280
280
|
enable_deletion: bool,
|
281
|
-
) -> tuple[bool, list]:
|
281
|
+
) -> tuple[bool, list[AccountUser]]:
|
282
282
|
disabled_deletion_detected = False
|
283
283
|
name = spec.name
|
284
284
|
account_enable_deletion = self.accounts[name].get("enableDeletion") or False
|
@@ -412,7 +412,9 @@ class TerraformClient:
|
|
412
412
|
)
|
413
413
|
return disabled_deletion_detected, created_users
|
414
414
|
|
415
|
-
def deletion_approved(
|
415
|
+
def deletion_approved(
|
416
|
+
self, account_name: str, resource_type: str, resource_name: str
|
417
|
+
) -> bool:
|
416
418
|
account = self.accounts[account_name]
|
417
419
|
deletion_approvals = account.get("deletionApprovals")
|
418
420
|
if not deletion_approvals:
|
@@ -439,11 +441,11 @@ class TerraformClient:
|
|
439
441
|
return False
|
440
442
|
|
441
443
|
# terraform apply
|
442
|
-
def apply(self):
|
444
|
+
def apply(self) -> bool:
|
443
445
|
errors = threaded.run(self.terraform_apply, self.specs, self.thread_pool_size)
|
444
446
|
return any(errors)
|
445
447
|
|
446
|
-
def terraform_apply(self, spec: TerraformSpec):
|
448
|
+
def terraform_apply(self, spec: TerraformSpec) -> bool:
|
447
449
|
with self._terraform_log_file(spec.working_dir) as (f, env):
|
448
450
|
return_code, stdout, stderr = lean_tf.apply(
|
449
451
|
spec.working_dir,
|
@@ -486,9 +488,9 @@ class TerraformClient:
|
|
486
488
|
|
487
489
|
return replicas_info
|
488
490
|
|
489
|
-
def format_output(self, output, type):
|
491
|
+
def format_output(self, output: Any, type: str) -> dict[str, dict[str, Any]]:
|
490
492
|
# data is a dictionary of dictionaries
|
491
|
-
data = {}
|
493
|
+
data: dict[str, dict[str, Any]] = {}
|
492
494
|
if output is None:
|
493
495
|
return data
|
494
496
|
|
@@ -643,7 +645,7 @@ class TerraformClient:
|
|
643
645
|
return error_occured
|
644
646
|
|
645
647
|
@staticmethod
|
646
|
-
def split_to_lines(*outputs):
|
648
|
+
def split_to_lines(*outputs: str) -> Any:
|
647
649
|
split_outputs = []
|
648
650
|
try:
|
649
651
|
for output in outputs:
|
@@ -656,7 +658,7 @@ class TerraformClient:
|
|
656
658
|
return split_outputs[0]
|
657
659
|
return split_outputs
|
658
660
|
|
659
|
-
def cleanup(self):
|
661
|
+
def cleanup(self) -> None:
|
660
662
|
if self._aws_api is not None:
|
661
663
|
self._aws_api.cleanup()
|
662
664
|
for wd in self.working_dirs.values():
|
@@ -757,7 +759,7 @@ class TerraformClient:
|
|
757
759
|
|
758
760
|
def validate_db_upgrade(
|
759
761
|
self, account_name: str, resource_name: str, resource_change: Mapping[str, Any]
|
760
|
-
):
|
762
|
+
) -> None:
|
761
763
|
"""
|
762
764
|
Determine whether the RDS engine version upgrade is valid.
|
763
765
|
|
@@ -862,7 +864,7 @@ class TerraformClient:
|
|
862
864
|
],
|
863
865
|
}
|
864
866
|
|
865
|
-
def is_supported(engine, version):
|
867
|
+
def is_supported(engine: str, version: str) -> bool:
|
866
868
|
parsed_version = pkg_version.parse(version)
|
867
869
|
if engine == "mysql":
|
868
870
|
return any(
|
{qontract_reconcile-0.10.2.dev311.dist-info → qontract_reconcile-0.10.2.dev313.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|