qontract-reconcile 0.10.2.dev101__py3-none-any.whl → 0.10.2.dev102__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.dev101.dist-info → qontract_reconcile-0.10.2.dev102.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev101.dist-info → qontract_reconcile-0.10.2.dev102.dist-info}/RECORD +6 -6
- reconcile/dynatrace_token_provider/dependencies.py +40 -28
- reconcile/dynatrace_token_provider/integration.py +1 -5
- {qontract_reconcile-0.10.2.dev101.dist-info → qontract_reconcile-0.10.2.dev102.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev101.dist-info → qontract_reconcile-0.10.2.dev102.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev101.dist-info → qontract_reconcile-0.10.2.dev102.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.dev102
|
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.dev101.dist-info → qontract_reconcile-0.10.2.dev102.dist-info}/RECORD
RENAMED
@@ -184,8 +184,8 @@ reconcile/cna/assets/asset.py,sha256=KWgA4fuDAEGsJwmR52WwK_YgSJMW-1cV2la3lmNf4iE
|
|
184
184
|
reconcile/cna/assets/asset_factory.py,sha256=7T7X_J6xIsoGETqBRI45_EyIKEdQcnRPt_GAuVuLQcc,785
|
185
185
|
reconcile/cna/assets/null.py,sha256=85mVh97atCoC0aLuX47poTZiyOthmziJeBsUw0c924w,1658
|
186
186
|
reconcile/dynatrace_token_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
187
|
-
reconcile/dynatrace_token_provider/dependencies.py,sha256=
|
188
|
-
reconcile/dynatrace_token_provider/integration.py,sha256=
|
187
|
+
reconcile/dynatrace_token_provider/dependencies.py,sha256=lvkdwqHMsn_2kgj-tUIJdTUnUNxVoS6z8k4nPkGglnQ,3129
|
188
|
+
reconcile/dynatrace_token_provider/integration.py,sha256=d2iAQ_NUUIVN4I0_Y-LQQtWuWuzclJcXGQC8dEWYGvQ,26365
|
189
189
|
reconcile/dynatrace_token_provider/metrics.py,sha256=oP-6NTZENFdvWiS0krnmX6tq3xyOzQ8e6vS0CZWYUuw,1496
|
190
190
|
reconcile/dynatrace_token_provider/model.py,sha256=gkpqo5rRRueBXnIMjp4EEHqBUBuU65TRI8zpdb8GJ0A,241
|
191
191
|
reconcile/dynatrace_token_provider/ocm.py,sha256=bryaK7xs7ygttUyZuSD9Up4laUhP6OUTr2VBbFiclpA,4298
|
@@ -786,7 +786,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
786
786
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
787
787
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
788
788
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
789
|
-
qontract_reconcile-0.10.2.
|
790
|
-
qontract_reconcile-0.10.2.
|
791
|
-
qontract_reconcile-0.10.2.
|
792
|
-
qontract_reconcile-0.10.2.
|
789
|
+
qontract_reconcile-0.10.2.dev102.dist-info/METADATA,sha256=Qg0wsgeMa_DS-6XE_EXPUY0U7j6R8Q1iszdAhkG4Ddw,24566
|
790
|
+
qontract_reconcile-0.10.2.dev102.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
791
|
+
qontract_reconcile-0.10.2.dev102.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
792
|
+
qontract_reconcile-0.10.2.dev102.dist-info/RECORD,,
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from collections.abc import Mapping
|
2
|
+
from typing import Self
|
2
3
|
|
3
4
|
from reconcile.dynatrace_token_provider.ocm import OCMClient
|
4
5
|
from reconcile.gql_definitions.dynatrace_token_provider.token_specs import (
|
@@ -36,34 +37,45 @@ class Dependencies:
|
|
36
37
|
self.ocm_client_by_env_name: dict[str, OCMClient] = dict(ocm_client_by_env_name)
|
37
38
|
self.token_spec_by_name = dict(token_spec_by_name)
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
@classmethod
|
41
|
+
def create(cls, secret_reader: SecretReaderBase) -> Self:
|
42
|
+
return cls(
|
43
|
+
secret_reader=secret_reader,
|
44
|
+
dynatrace_client_by_tenant_id=_dynatrace_client_map(
|
45
|
+
secret_reader=secret_reader
|
46
|
+
),
|
47
|
+
ocm_client_by_env_name=_ocm_clients(secret_reader=secret_reader),
|
48
|
+
token_spec_by_name=_token_specs(),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
def _token_specs() -> dict[str, DynatraceTokenProviderTokenSpecV1]:
|
53
|
+
token_specs = get_dynatrace_token_provider_token_specs()
|
54
|
+
return {spec.name: spec for spec in token_specs}
|
43
55
|
|
44
|
-
def populate_token_specs(self) -> None:
|
45
|
-
token_specs = get_dynatrace_token_provider_token_specs()
|
46
|
-
self.token_spec_by_name = {spec.name: spec for spec in token_specs}
|
47
56
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
def _dynatrace_client_map(
|
58
|
+
secret_reader: SecretReaderBase,
|
59
|
+
) -> dict[str, DynatraceClient]:
|
60
|
+
dynatrace_client_by_tenant_id: dict[str, DynatraceClient] = {}
|
61
|
+
dynatrace_environments = get_dynatrace_environments()
|
62
|
+
if not dynatrace_environments:
|
63
|
+
raise RuntimeError("No Dynatrace environment defined.")
|
64
|
+
for tenant in dynatrace_environments:
|
65
|
+
dt_api_token = secret_reader.read_secret(tenant.bootstrap_token)
|
66
|
+
dt_client = DynatraceClient.create(
|
67
|
+
environment_url=tenant.environment_url,
|
68
|
+
token=dt_api_token,
|
69
|
+
api=None,
|
70
|
+
)
|
71
|
+
tenant_id = tenant.environment_url.split(".")[0].removeprefix("https://")
|
72
|
+
dynatrace_client_by_tenant_id[tenant_id] = dt_client
|
73
|
+
return dynatrace_client_by_tenant_id
|
74
|
+
|
61
75
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
for env in ocm_environments
|
69
|
-
}
|
76
|
+
def _ocm_clients(secret_reader: SecretReaderBase) -> dict[str, OCMClient]:
|
77
|
+
ocm_environments = get_ocm_environments()
|
78
|
+
return {
|
79
|
+
env.name: OCMClient(ocm_client=init_ocm_base_client(env, secret_reader))
|
80
|
+
for env in ocm_environments
|
81
|
+
}
|
@@ -82,13 +82,9 @@ class DynatraceTokenProviderIntegration(QontractReconcileIntegration[NoParams]):
|
|
82
82
|
return QONTRACT_INTEGRATION
|
83
83
|
|
84
84
|
def run(self, dry_run: bool) -> None:
|
85
|
-
dependencies = Dependencies(
|
85
|
+
dependencies = Dependencies.create(
|
86
86
|
secret_reader=self.secret_reader,
|
87
|
-
dynatrace_client_by_tenant_id={},
|
88
|
-
ocm_client_by_env_name={},
|
89
|
-
token_spec_by_name={},
|
90
87
|
)
|
91
|
-
dependencies.populate_all()
|
92
88
|
self.reconcile(dry_run=dry_run, dependencies=dependencies)
|
93
89
|
|
94
90
|
def _token_cnt(self, dt_tenant_id: str, ocm_env_name: str) -> None:
|
{qontract_reconcile-0.10.2.dev101.dist-info → qontract_reconcile-0.10.2.dev102.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|