qontract-reconcile 0.10.1rc948__py3-none-any.whl → 0.10.1rc950__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.1rc948
3
+ Version: 0.10.1rc950
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
@@ -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
@@ -813,7 +815,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
813
815
  tools/app_interface_reporter.py,sha256=uy9eRHf6EdvD8ZY2WYdroGXm18DOdnqVZyxaWN3Bm_0,17724
814
816
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
815
817
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
816
- tools/qontract_cli.py,sha256=wF3CcF0Acgid41rPxD_8Y9FMb1dDQGJnvqkk8iwiXVs,124415
818
+ tools/qontract_cli.py,sha256=jzJ8okavMK6pqT14KYXV13bGxAaeRn2RPz4G_hGJj3g,124440
817
819
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
818
820
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
819
821
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.1rc948.dist-info/METADATA,sha256=EANO3eIGME2obDm2HO01Vd2LeR5lLaf6_JBfi6ZJEew,2262
848
- qontract_reconcile-0.10.1rc948.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
849
- qontract_reconcile-0.10.1rc948.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
850
- qontract_reconcile-0.10.1rc948.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
851
- qontract_reconcile-0.10.1rc948.dist-info/RECORD,,
849
+ qontract_reconcile-0.10.1rc950.dist-info/METADATA,sha256=68rjYO_yguToaqfByY1BPGufGV1SFwkBdqZy5bt2OtU,2262
850
+ qontract_reconcile-0.10.1rc950.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
851
+ qontract_reconcile-0.10.1rc950.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
852
+ qontract_reconcile-0.10.1rc950.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
853
+ qontract_reconcile-0.10.1rc950.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)
tools/qontract_cli.py CHANGED
@@ -2752,7 +2752,7 @@ def jenkins_jobs(ctx):
2752
2752
  for pj in project["jobs"]:
2753
2753
  for job in pj.values():
2754
2754
  node = job["node"] if "node" in job else root_node
2755
- if node == "rhel8":
2755
+ if node in {"rhel8", "rhel8-app-interface"}:
2756
2756
  apps[app_name]["rhel8"] += 1
2757
2757
  totals["rhel8"] += 1
2758
2758
  else: