qontract-reconcile 0.10.1rc892__py3-none-any.whl → 0.10.1rc894__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.1rc892
3
+ Version: 0.10.1rc894
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
@@ -594,6 +594,7 @@ reconcile/typed_queries/clusters_minimal.py,sha256=bQCRqiHz6jUPPQFmfqKXouvmDuDC1
594
594
  reconcile/typed_queries/clusters_with_dms.py,sha256=JDSKZXwO3QxT-uA1FaHxP8d4XiYA9CeeV2HEukppfxQ,519
595
595
  reconcile/typed_queries/clusters_with_peering.py,sha256=lIai7SJJD0bqIJbe7virgrbYRqjLouSL2OpJD0itpAY,330
596
596
  reconcile/typed_queries/dynatrace.py,sha256=8vXDXDIDf9_vN_efYwysDr4gLN7SCx4I2bOoNxQhbio,312
597
+ reconcile/typed_queries/dynatrace_environments.py,sha256=VV_7KzKG9wqGDV9wZLbcCJtfuzPhTV1wdg0YwAOaq3A,413
597
598
  reconcile/typed_queries/external_resources.py,sha256=h1uzZzmtEGzoqSFhDMSAdxauGJoGy0stPuWbA0rkVKE,1503
598
599
  reconcile/typed_queries/get_state_aws_account.py,sha256=CSJjVPWsUZ2rkGIt8ehoQt7hokFqrUDgG9HFlg2lVD8,492
599
600
  reconcile/typed_queries/github_orgs.py,sha256=UZhoPl8qvA_tcO7CZlN8GuMKckt3ywd47Suu61rgHsc,258
@@ -705,7 +706,7 @@ reconcile/utils/state.py,sha256=sJbfxvSTnHlHfgQRc_vRz-U_9NnVFGq-W8DX3ZHkfeY,1635
705
706
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
706
707
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
707
708
  reconcile/utils/terraform_client.py,sha256=zbx5Ng2Xm7P93qqvFCbR-2FFYUTlmZbLGYNWvpkDtzE,32400
708
- reconcile/utils/terrascript_aws_client.py,sha256=ZX6oJWYmxRxbOkGYhCLAhFr20dIQy_TWZCqQL_1KDPg,275885
709
+ reconcile/utils/terrascript_aws_client.py,sha256=kU--Qk42v7OXbOtBEBhgRPRdSiFcfXOvMS6stHs0r_o,276712
709
710
  reconcile/utils/three_way_diff_strategy.py,sha256=OniTnogBkdgy_7Xg51N1MgjS-Qtk8uM1ccjWaiXxiV8,4895
710
711
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
711
712
  reconcile/utils/vault.py,sha256=f4mJLKE5vGMvNBbo8Xe0dPFLF5-Vchs5Ry5lyf0FuMg,14902
@@ -843,8 +844,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
843
844
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
844
845
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
845
846
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
846
- qontract_reconcile-0.10.1rc892.dist-info/METADATA,sha256=e9L24wufs03igQkaJ7Ej0xluece2ZuN9tfjotAvkYzs,2273
847
- qontract_reconcile-0.10.1rc892.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
848
- qontract_reconcile-0.10.1rc892.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
849
- qontract_reconcile-0.10.1rc892.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
850
- qontract_reconcile-0.10.1rc892.dist-info/RECORD,,
847
+ qontract_reconcile-0.10.1rc894.dist-info/METADATA,sha256=FElsZtwK2NOLWnqQeylMVwkHJTableHaBaIg-fZpHmw,2273
848
+ qontract_reconcile-0.10.1rc894.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
849
+ qontract_reconcile-0.10.1rc894.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
850
+ qontract_reconcile-0.10.1rc894.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
851
+ qontract_reconcile-0.10.1rc894.dist-info/RECORD,,
@@ -0,0 +1,14 @@
1
+ from reconcile.gql_definitions.dynatrace_token_provider.dynatrace_bootstrap_tokens import (
2
+ DynatraceEnvironmentV1,
3
+ query,
4
+ )
5
+ from reconcile.utils import gql
6
+ from reconcile.utils.gql import GqlApi
7
+
8
+
9
+ def get_dynatrace_environments(
10
+ api: GqlApi | None = None,
11
+ ) -> list[DynatraceEnvironmentV1]:
12
+ api = api if api else gql.get_api()
13
+ data = query(api.query)
14
+ return list(data.environments or [])
@@ -7,6 +7,7 @@ import random
7
7
  import re
8
8
  import string
9
9
  import tempfile
10
+ from collections import Counter
10
11
  from collections.abc import (
11
12
  Iterable,
12
13
  Mapping,
@@ -272,6 +273,18 @@ DEFAULT_TAGS = {
272
273
  }
273
274
 
274
275
 
276
+ class OutputResourceNameNotUniqueException(Exception):
277
+ def __init__(self, namespace, duplicates):
278
+ self.namespace, self.duplicates = namespace, duplicates
279
+ super().__init__(
280
+ str.format(
281
+ "Found duplicate values {} for 'output_resource_name' in namespace {}. Please ensure 'output_resource_name' is unique in a given namespace.",
282
+ self.duplicates,
283
+ self.namespace,
284
+ )
285
+ )
286
+
287
+
275
288
  class StateInaccessibleException(Exception):
276
289
  pass
277
290
 
@@ -1491,12 +1504,19 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
1491
1504
  specs = get_external_resource_specs(
1492
1505
  namespace_info, provision_provider=PROVIDER_AWS
1493
1506
  )
1507
+ name_counter = Counter(spec.output_resource_name for spec in specs)
1508
+ duplicates = [name for name, count in name_counter.items() if count > 1]
1509
+ if duplicates:
1510
+ raise OutputResourceNameNotUniqueException(
1511
+ namespace_info.get("name"), duplicates
1512
+ )
1494
1513
  for spec in specs:
1495
1514
  if account_names and spec.provisioner_name not in account_names:
1496
1515
  continue
1497
1516
  self.account_resource_specs.setdefault(
1498
1517
  spec.provisioner_name, []
1499
1518
  ).append(spec)
1519
+
1500
1520
  self.resource_spec_inventory[spec.id_object()] = spec
1501
1521
 
1502
1522
  def populate_tf_resources(self, spec, ocm_map=None):