qontract-reconcile 0.10.1rc991__py3-none-any.whl → 0.10.1rc993__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.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/RECORD +10 -9
- reconcile/gql_definitions/ocm_subscription_labels/__init__.py +0 -0
- reconcile/gql_definitions/terraform_repo/terraform_repo.py +2 -0
- reconcile/terraform_repo.py +2 -0
- reconcile/test/test_terraform_repo.py +25 -0
- reconcile/utils/dynatrace/client.py +33 -0
- {qontract_reconcile-0.10.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc991.dist-info → qontract_reconcile-0.10.1rc993.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.1rc993
|
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.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/RECORD
RENAMED
@@ -112,7 +112,7 @@ reconcile/terraform_aws_route53.py,sha256=1C1_xd_xjysPLSYKvohS6bfSsjSMP0U3sWVcRN
|
|
112
112
|
reconcile/terraform_cloudflare_dns.py,sha256=-aLEe2QnH5cJPu7HWqs-R9NmQ1NlFbcVUm0v7alVL3I,13431
|
113
113
|
reconcile/terraform_cloudflare_resources.py,sha256=41Mj1WkuS75slCDpmhG2GGf1nh3BwfxcdNC73-PNadc,15000
|
114
114
|
reconcile/terraform_cloudflare_users.py,sha256=iyTG5sj20Jg4J4qWJ144KVptfIHGOSfH8wQKxu0imq0,13942
|
115
|
-
reconcile/terraform_repo.py,sha256=
|
115
|
+
reconcile/terraform_repo.py,sha256=E-tVE62H5-B8CStVOi_DwqQ5l3qIYGd-l8MBFSo41mQ,16414
|
116
116
|
reconcile/terraform_resources.py,sha256=-sgMMHDtNvnQyNR05-MKebI_pSiyxSWAg8LmeA2_Ntk,19326
|
117
117
|
reconcile/terraform_tgw_attachments.py,sha256=EucuF4p3RWKTS4GTPd8oZmR79GpIW_grQl2PAeeNQeI,18665
|
118
118
|
reconcile/terraform_users.py,sha256=HqSm3ev3b8dZ9J6F_phDZB-FQsnlsdeKp9RPoY1cU94,10188
|
@@ -339,6 +339,7 @@ reconcile/gql_definitions/ocm_labels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
339
339
|
reconcile/gql_definitions/ocm_labels/clusters.py,sha256=K0DaTnOEdCZAziDbmq3Ktrxzzmzy6sdb3-9kIDk6yao,2932
|
340
340
|
reconcile/gql_definitions/ocm_labels/organizations.py,sha256=ylNna62pG3XidrLQtMwu0LIOsKh6qyC2QImCbur2tV4,2252
|
341
341
|
reconcile/gql_definitions/ocm_oidc_idp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
342
|
+
reconcile/gql_definitions/ocm_subscription_labels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
342
343
|
reconcile/gql_definitions/openshift_cluster_bots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
343
344
|
reconcile/gql_definitions/openshift_cluster_bots/clusters.py,sha256=QshhCQeFRu_o0DLpD-4ltT5X_xZHjsCLc5jB3an3UXs,3688
|
344
345
|
reconcile/gql_definitions/openshift_groups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -384,7 +385,7 @@ reconcile/gql_definitions/terraform_cloudflare_users/terraform_cloudflare_roles.
|
|
384
385
|
reconcile/gql_definitions/terraform_init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
385
386
|
reconcile/gql_definitions/terraform_init/aws_accounts.py,sha256=OJ0hDbRachRaDkL-OGT6-byr9cKdBiQDnNCpwUe3oJ8,2674
|
386
387
|
reconcile/gql_definitions/terraform_repo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
387
|
-
reconcile/gql_definitions/terraform_repo/terraform_repo.py,sha256=
|
388
|
+
reconcile/gql_definitions/terraform_repo/terraform_repo.py,sha256=nm4CH7Vog4aabdvCKmhVSUvoUb7dxSLx8nwAEJAVqG0,3706
|
388
389
|
reconcile/gql_definitions/terraform_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
389
390
|
reconcile/gql_definitions/terraform_resources/database_access_manager.py,sha256=yv0_YC-LmhaKD_gyGG3le1w5BtypBjlsO894-Zgdg4U,4813
|
390
391
|
reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py,sha256=1PQBvcJjErRaG529kAzMwfw-ShNaM92IQovlwEiYrV8,42491
|
@@ -553,7 +554,7 @@ reconcile/test/test_terraform_aws_route53.py,sha256=xHggb8K1P76OyCfFcogbkmyKle-N
|
|
553
554
|
reconcile/test/test_terraform_cloudflare_dns.py,sha256=aQTXX8Vr4h9aWvJZTnpZEhMGYoBpT2d45ZxU_ECIQ6o,3425
|
554
555
|
reconcile/test/test_terraform_cloudflare_resources.py,sha256=1mdSZS-38mtTSg7teJgDCJU1b_yKbwnrr3N5m8kwV4k,13595
|
555
556
|
reconcile/test/test_terraform_cloudflare_users.py,sha256=2VGBtMUhckLPtUnQlHIzpGsCnyVJZPNLFf-ABELkxbQ,27456
|
556
|
-
reconcile/test/test_terraform_repo.py,sha256=
|
557
|
+
reconcile/test/test_terraform_repo.py,sha256=INfl-VlUtpV87J0neQt4wliptnX7PKvxLPF-ZgweTFA,12960
|
557
558
|
reconcile/test/test_terraform_resources.py,sha256=8C97yXIEihaQ3DZrtjxLNt4y4G12IOhD01ydm7JjliY,15359
|
558
559
|
reconcile/test/test_terraform_tgw_attachments.py,sha256=SM6QwogMZNLh0BkUyaxzFafuOLp23-hBtYTu_F53C4I,40922
|
559
560
|
reconcile/test/test_terraform_users.py,sha256=XOAfGvITCJPI1LTlISmHbA4ONMQMkxYUMTsny7pQCFw,4319
|
@@ -739,7 +740,7 @@ reconcile/utils/clusterhealth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
739
740
|
reconcile/utils/clusterhealth/providerbase.py,sha256=DXomGYogckBLqWtXn0PXU0hWYxB6K0F7ernldrkHhVY,1140
|
740
741
|
reconcile/utils/clusterhealth/telemeter.py,sha256=PllSLsJXvGNatmTF4mxCNPVbDrpr_MPk0m5pWj-LT6g,1534
|
741
742
|
reconcile/utils/dynatrace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
742
|
-
reconcile/utils/dynatrace/client.py,sha256=
|
743
|
+
reconcile/utils/dynatrace/client.py,sha256=siVDdCQeLaWm4W1T-QKnFwlotPmXmZfpyoe3pXowBt8,2760
|
743
744
|
reconcile/utils/glitchtip/__init__.py,sha256=FT6iBhGqoe7KExFdbgL8AYUb64iW_4snF5__Dcl7yt0,258
|
744
745
|
reconcile/utils/glitchtip/client.py,sha256=ovh4tx-ajlihjvcq6nyY4chulbuMJYvzDPv9j9CuAKM,7867
|
745
746
|
reconcile/utils/glitchtip/models.py,sha256=uHbCK9-RWgxNYUAkEHXRAZRDDZW7jkOFFt9MdlqN4bU,6481
|
@@ -853,8 +854,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
|
|
853
854
|
tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
|
854
855
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
855
856
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
856
|
-
qontract_reconcile-0.10.
|
857
|
-
qontract_reconcile-0.10.
|
858
|
-
qontract_reconcile-0.10.
|
859
|
-
qontract_reconcile-0.10.
|
860
|
-
qontract_reconcile-0.10.
|
857
|
+
qontract_reconcile-0.10.1rc993.dist-info/METADATA,sha256=D2wGMe7boygHgZavBj6P-78L2Mx4C9FZxKzi-rHUTYc,2262
|
858
|
+
qontract_reconcile-0.10.1rc993.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
859
|
+
qontract_reconcile-0.10.1rc993.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
860
|
+
qontract_reconcile-0.10.1rc993.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
861
|
+
qontract_reconcile-0.10.1rc993.dist-info/RECORD,,
|
File without changes
|
@@ -53,6 +53,7 @@ query TerraformRepo {
|
|
53
53
|
delete
|
54
54
|
requireFips
|
55
55
|
tfVersion
|
56
|
+
forceRerunTimestamp
|
56
57
|
variables {
|
57
58
|
inputs {
|
58
59
|
...VaultSecret
|
@@ -105,6 +106,7 @@ class TerraformRepoV1(ConfiguredBaseModel):
|
|
105
106
|
delete: Optional[bool] = Field(..., alias="delete")
|
106
107
|
require_fips: Optional[bool] = Field(..., alias="requireFips")
|
107
108
|
tf_version: str = Field(..., alias="tfVersion")
|
109
|
+
force_rerun_timestamp: Optional[str] = Field(..., alias="forceRerunTimestamp")
|
108
110
|
variables: Optional[TerraformRepoVariablesV1] = Field(..., alias="variables")
|
109
111
|
|
110
112
|
|
reconcile/terraform_repo.py
CHANGED
@@ -361,6 +361,8 @@ class TerraformRepoIntegration(
|
|
361
361
|
)
|
362
362
|
if self.params.validate_git:
|
363
363
|
self.check_ref(d.repository, d.ref)
|
364
|
+
if c.force_rerun_timestamp != d.force_rerun_timestamp:
|
365
|
+
logging.info("user has forced a re-run of tf-repo execution")
|
364
366
|
|
365
367
|
if len(merged) != 0:
|
366
368
|
if not dry_run and state:
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from datetime import datetime
|
1
2
|
from unittest.mock import MagicMock
|
2
3
|
|
3
4
|
import pytest
|
@@ -46,6 +47,7 @@ def existing_repo(aws_account, tf_variables) -> TerraformRepoV1:
|
|
46
47
|
requireFips=True,
|
47
48
|
tfVersion=A_REPO_VERSION,
|
48
49
|
variables=tf_variables,
|
50
|
+
forceRerunTimestamp=None,
|
49
51
|
)
|
50
52
|
|
51
53
|
|
@@ -86,6 +88,7 @@ def new_repo(aws_account_no_state) -> TerraformRepoV1:
|
|
86
88
|
requireFips=False,
|
87
89
|
tfVersion=B_REPO_VERSION,
|
88
90
|
variables=None,
|
91
|
+
forceRerunTimestamp=None,
|
89
92
|
)
|
90
93
|
|
91
94
|
|
@@ -220,6 +223,27 @@ def test_updating_repo_ref(existing_repo, int_params, state_mock):
|
|
220
223
|
)
|
221
224
|
|
222
225
|
|
226
|
+
def test_force_rerun(existing_repo, int_params, state_mock):
|
227
|
+
existing = [existing_repo]
|
228
|
+
updated_repo = TerraformRepoV1.copy(existing_repo)
|
229
|
+
updated_repo.force_rerun_timestamp = datetime.now().isoformat()
|
230
|
+
|
231
|
+
integration = TerraformRepoIntegration(params=int_params)
|
232
|
+
diff = integration.calculate_diff(
|
233
|
+
existing_state=existing,
|
234
|
+
desired_state=[updated_repo],
|
235
|
+
dry_run=False,
|
236
|
+
state=state_mock,
|
237
|
+
recreate_state=False,
|
238
|
+
)
|
239
|
+
|
240
|
+
assert diff == [updated_repo]
|
241
|
+
|
242
|
+
state_mock.add.assert_called_once_with(
|
243
|
+
updated_repo.name, updated_repo.dict(by_alias=True), force=True
|
244
|
+
)
|
245
|
+
|
246
|
+
|
223
247
|
def test_fail_on_update_invalid_repo_params(existing_repo, int_params):
|
224
248
|
existing = [existing_repo]
|
225
249
|
updated_repo = TerraformRepoV1.copy(existing_repo)
|
@@ -291,6 +315,7 @@ def test_get_repo_state(s3_state_builder, int_params, existing_repo, tf_variable
|
|
291
315
|
"requireFips": True,
|
292
316
|
"tfVersion": A_REPO_VERSION,
|
293
317
|
"variables": tf_variables,
|
318
|
+
"forceRerunTimestamp": None,
|
294
319
|
"account": {
|
295
320
|
"name": "foo",
|
296
321
|
"uid": AWS_UID,
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
from collections.abc import Iterable
|
4
4
|
|
5
5
|
from dynatrace import Dynatrace
|
6
|
+
from dynatrace.environment_v2.tokens_api import ApiTokenUpdate
|
6
7
|
from pydantic import BaseModel
|
7
8
|
|
8
9
|
|
@@ -10,6 +11,10 @@ class DynatraceTokenCreationError(Exception):
|
|
10
11
|
pass
|
11
12
|
|
12
13
|
|
14
|
+
class DynatraceTokenUpdateError(Exception):
|
15
|
+
pass
|
16
|
+
|
17
|
+
|
13
18
|
class DynatraceTokenRetrievalError(Exception):
|
14
19
|
pass
|
15
20
|
|
@@ -23,6 +28,11 @@ class DynatraceAPITokenCreated(BaseModel):
|
|
23
28
|
id: str
|
24
29
|
|
25
30
|
|
31
|
+
class DynatraceAPIToken(BaseModel):
|
32
|
+
id: str
|
33
|
+
scopes: list[str]
|
34
|
+
|
35
|
+
|
26
36
|
class DynatraceClient:
|
27
37
|
def __init__(self, environment_url: str, api: Dynatrace) -> None:
|
28
38
|
self._environment_url = environment_url
|
@@ -48,6 +58,29 @@ class DynatraceClient:
|
|
48
58
|
) from e
|
49
59
|
return [token.id for token in dt_tokens if token.name.startswith(prefix)]
|
50
60
|
|
61
|
+
def get_token_by_id(self, token_id: str) -> DynatraceAPIToken:
|
62
|
+
try:
|
63
|
+
token = self._api.tokens.get(token_id=token_id)
|
64
|
+
except Exception as e:
|
65
|
+
raise DynatraceTokenRetrievalError(
|
66
|
+
f"{self._environment_url=} Failed to retrieve token for {token_id=}", e
|
67
|
+
) from e
|
68
|
+
return DynatraceAPIToken(id=token.id, scopes=token.scopes)
|
69
|
+
|
70
|
+
def update_token_scopes(self, token_id: str, scopes: list[str]) -> None:
|
71
|
+
try:
|
72
|
+
self._api.tokens.put(
|
73
|
+
token_id=token_id,
|
74
|
+
api_token=ApiTokenUpdate(
|
75
|
+
scopes=scopes,
|
76
|
+
),
|
77
|
+
)
|
78
|
+
except Exception as e:
|
79
|
+
raise DynatraceTokenUpdateError(
|
80
|
+
f"{self._environment_url=} Failed to update token scopes for {token_id=}",
|
81
|
+
e,
|
82
|
+
) from e
|
83
|
+
|
51
84
|
@staticmethod
|
52
85
|
def create(
|
53
86
|
environment_url: str, token: str | None, api: Dynatrace | None
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc991.dist-info → qontract_reconcile-0.10.1rc993.dist-info}/top_level.txt
RENAMED
File without changes
|