qontract-reconcile 0.10.1rc947__py3-none-any.whl → 0.10.1rc949__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.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/RECORD +8 -6
- reconcile/utils/dynatrace/__init__.py +0 -0
- reconcile/utils/dynatrace/client.py +57 -0
- reconcile/utils/saasherder/saasherder.py +3 -3
- {qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc949
|
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
|
{qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/RECORD
RENAMED
@@ -732,6 +732,8 @@ reconcile/utils/cloud_resource_best_practice/aws_rds.py,sha256=EvE6XKLsrZ531MJpt
|
|
732
732
|
reconcile/utils/clusterhealth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
733
733
|
reconcile/utils/clusterhealth/providerbase.py,sha256=DXomGYogckBLqWtXn0PXU0hWYxB6K0F7ernldrkHhVY,1140
|
734
734
|
reconcile/utils/clusterhealth/telemeter.py,sha256=plZ2xInKJ1ZzgZGPMJzPYmPAWCG2YUxs8j_9IPsqsH8,1426
|
735
|
+
reconcile/utils/dynatrace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
736
|
+
reconcile/utils/dynatrace/client.py,sha256=CsjhxyCxum2X_cl8bAe701rUvVu6PflAwIR0nBEQ2yU,1697
|
735
737
|
reconcile/utils/glitchtip/__init__.py,sha256=FT6iBhGqoe7KExFdbgL8AYUb64iW_4snF5__Dcl7yt0,258
|
736
738
|
reconcile/utils/glitchtip/client.py,sha256=EXJVIc0aUqkfApU4IIDoc89841XgUL7jJNyb0gLDpMI,7736
|
737
739
|
reconcile/utils/glitchtip/models.py,sha256=i3DsGoRJkAeOVsdCEqjlMRjJcYBMXf9Qtx5VpG9xgdA,6391
|
@@ -793,7 +795,7 @@ reconcile/utils/runtime/sharding.py,sha256=r0ieUtNed7NvknSw6qQrCkKpVXE1shuHGnfFc
|
|
793
795
|
reconcile/utils/saasherder/__init__.py,sha256=J3MBZBFa5YmhqYm08QsjBXz8mFcVOCiOCkyIcw41t7E,343
|
794
796
|
reconcile/utils/saasherder/interfaces.py,sha256=C2wrw34OXypshVocAsPrVZsSHptgw4g9u7Haa2wulZQ,9087
|
795
797
|
reconcile/utils/saasherder/models.py,sha256=z8ln03zi2a8cu716NcNUDHp8Dv1VcVbhqdWVxCl7x9A,10148
|
796
|
-
reconcile/utils/saasherder/saasherder.py,sha256=
|
798
|
+
reconcile/utils/saasherder/saasherder.py,sha256=BVGG0o6IQotX3zhTI1dewcfHtaoCQ_YYlmLd0oSRFfs,84444
|
797
799
|
reconcile/utils/terraform/__init__.py,sha256=zNbiyTWo35AT1sFTElL2j_AA0jJ_yWE_bfFn-nD2xik,250
|
798
800
|
reconcile/utils/terraform/config.py,sha256=5UVrd563TMcvi4ooa5JvWVDW1I3bIWg484u79evfV_8,164
|
799
801
|
reconcile/utils/terraform/config_client.py,sha256=3gUIIIEv52Vx7-VgQ2FZYfCCrfqUv_5gw_TQ3mbLcTs,4666
|
@@ -844,8 +846,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
|
|
844
846
|
tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
|
845
847
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
846
848
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
847
|
-
qontract_reconcile-0.10.
|
848
|
-
qontract_reconcile-0.10.
|
849
|
-
qontract_reconcile-0.10.
|
850
|
-
qontract_reconcile-0.10.
|
851
|
-
qontract_reconcile-0.10.
|
849
|
+
qontract_reconcile-0.10.1rc949.dist-info/METADATA,sha256=SaOcWUK9s8vt6wWla8KbHay5iD3vZYVIDq89zJMrRYA,2262
|
850
|
+
qontract_reconcile-0.10.1rc949.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
851
|
+
qontract_reconcile-0.10.1rc949.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
852
|
+
qontract_reconcile-0.10.1rc949.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
853
|
+
qontract_reconcile-0.10.1rc949.dist-info/RECORD,,
|
File without changes
|
@@ -0,0 +1,57 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from collections.abc import Iterable
|
4
|
+
|
5
|
+
from dynatrace import Dynatrace
|
6
|
+
from pydantic import BaseModel
|
7
|
+
|
8
|
+
|
9
|
+
class DynatraceTokenCreationError(Exception):
|
10
|
+
pass
|
11
|
+
|
12
|
+
|
13
|
+
class DynatraceTokenRetrievalError(Exception):
|
14
|
+
pass
|
15
|
+
|
16
|
+
|
17
|
+
class DynatraceAPITokenCreated(BaseModel):
|
18
|
+
"""
|
19
|
+
Wrap dynatrace.ApiTokenCreated for decoupling
|
20
|
+
"""
|
21
|
+
|
22
|
+
token: str
|
23
|
+
id: str
|
24
|
+
|
25
|
+
|
26
|
+
class DynatraceClient:
|
27
|
+
def __init__(self, environment_url: str, api: Dynatrace) -> None:
|
28
|
+
self._environment_url = environment_url
|
29
|
+
self._api = api
|
30
|
+
|
31
|
+
def create_api_token(
|
32
|
+
self, name: str, scopes: Iterable[str]
|
33
|
+
) -> DynatraceAPITokenCreated:
|
34
|
+
try:
|
35
|
+
token = self._api.tokens.create(name=name, scopes=scopes)
|
36
|
+
except Exception as e:
|
37
|
+
raise DynatraceTokenCreationError(
|
38
|
+
f"{self._environment_url=} Failed to create token for {name=}", e
|
39
|
+
) from e
|
40
|
+
return DynatraceAPITokenCreated(token=token.token, id=token.id)
|
41
|
+
|
42
|
+
def get_token_ids_for_name_prefix(self, prefix: str) -> list[str]:
|
43
|
+
try:
|
44
|
+
dt_tokens = self._api.tokens.list()
|
45
|
+
except Exception as e:
|
46
|
+
raise DynatraceTokenRetrievalError(
|
47
|
+
f"{self._environment_url=} Failed to retrieve tokens for {prefix=}", e
|
48
|
+
) from e
|
49
|
+
return [token.id for token in dt_tokens if token.name.startswith(prefix)]
|
50
|
+
|
51
|
+
@staticmethod
|
52
|
+
def create(
|
53
|
+
environment_url: str, token: str | None, api: Dynatrace | None
|
54
|
+
) -> DynatraceClient:
|
55
|
+
if not api:
|
56
|
+
api = Dynatrace(base_url=environment_url, token=token)
|
57
|
+
return DynatraceClient(environment_url=environment_url, api=api)
|
@@ -769,7 +769,7 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
769
769
|
self, url: str, path: str, ref: str, github: Github
|
770
770
|
) -> tuple[list[Any], str]:
|
771
771
|
commit_sha = self._get_commit_sha(url, ref, github)
|
772
|
-
resources = []
|
772
|
+
resources: list[Any] = []
|
773
773
|
if "github" in url:
|
774
774
|
repo_name = url.rstrip("/").replace("https://github.com/", "")
|
775
775
|
repo = github.get_repo(repo_name)
|
@@ -781,8 +781,8 @@ class SaasHerder: # pylint: disable=too-many-public-methods
|
|
781
781
|
file_contents_decoded = self._get_file_contents_github(
|
782
782
|
repo, file_path, commit_sha
|
783
783
|
)
|
784
|
-
|
785
|
-
resources.
|
784
|
+
result_resources = yaml.safe_load_all(file_contents_decoded)
|
785
|
+
resources.extend(result_resources)
|
786
786
|
elif "gitlab" in url:
|
787
787
|
if not self.gitlab:
|
788
788
|
raise Exception("gitlab is not initialized")
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc947.dist-info → qontract_reconcile-0.10.1rc949.dist-info}/top_level.txt
RENAMED
File without changes
|