qontract-reconcile 0.10.1rc1199__py3-none-any.whl → 0.10.1rc1200__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.1rc1199
3
+ Version: 0.10.1rc1200
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
@@ -196,10 +196,10 @@ reconcile/external_resources/aws.py,sha256=NSaOeHqFEcMaMxNjJwuQZosolgsJ8XRVvwkEE
196
196
  reconcile/external_resources/factories.py,sha256=TyJMaijDfPIFYks9i6dhKN7nSR1BoCkoBs1iPExKpcE,5493
197
197
  reconcile/external_resources/integration.py,sha256=gBVO5dE8JyZ3xYcYik-MTIp_18oU7_hpYc_oztyfElQ,6753
198
198
  reconcile/external_resources/integration_secrets_sync.py,sha256=dX09O3r6KURziUYYfiki10orNjOGVma-XojhVqd0ww4,1667
199
- reconcile/external_resources/manager.py,sha256=X5ErbtpCKsgAcUi65ZSXICPGxo5MAvNgWPHm_oNlaA8,15445
199
+ reconcile/external_resources/manager.py,sha256=HATI3oWDyxIt7k_SynXqk4CYQzCJHGPmig1XEJoNOA0,15832
200
200
  reconcile/external_resources/meta.py,sha256=noaytFzmShpzLA_ebGh7wuP45mOfHIOnnoUxivjDa1I,672
201
201
  reconcile/external_resources/metrics.py,sha256=8MZgNtNZzIRSYTX97KEUIUTETZBhitULzWxbShGyMO8,3193
202
- reconcile/external_resources/model.py,sha256=8F2-ks-MomF9pQLkplYayTWdjnKf74szce3o_QkFkLs,10889
202
+ reconcile/external_resources/model.py,sha256=YJylbAhetN9szpLUFd9jFqxCRMvSWXVxSC9OMQNV-wg,11316
203
203
  reconcile/external_resources/reconciler.py,sha256=K9QvbQCIOCuOHnPIxQE_P_jFtrkF3dGo8d_cCCh08Ys,8973
204
204
  reconcile/external_resources/secrets_sync.py,sha256=H8JfI3JW1XEau1jqv15AhYg49mCZeHwZmqMzMv_6tFc,16344
205
205
  reconcile/external_resources/state.py,sha256=7DBzVhIvYqeZWrWapmU_bXXftTQa_m-EOwJFVlIFnDw,9583
@@ -882,8 +882,8 @@ tools/test/test_qontract_cli.py,sha256=iuzKbQ6ahinvjoQmQLBrG4shey0z-1rB6qCgS8T6d
882
882
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
883
883
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
884
884
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
885
- qontract_reconcile-0.10.1rc1199.dist-info/METADATA,sha256=L2cXRJAPGUQMnGZHs38z11biOeCYbgwMUvcdrg0EpII,2213
886
- qontract_reconcile-0.10.1rc1199.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
887
- qontract_reconcile-0.10.1rc1199.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
- qontract_reconcile-0.10.1rc1199.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
- qontract_reconcile-0.10.1rc1199.dist-info/RECORD,,
885
+ qontract_reconcile-0.10.1rc1200.dist-info/METADATA,sha256=TsJMZagQbxyhlVsDImDJTdadVxpB3agV14BYdeZkSo4,2213
886
+ qontract_reconcile-0.10.1rc1200.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
887
+ qontract_reconcile-0.10.1rc1200.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
+ qontract_reconcile-0.10.1rc1200.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
+ qontract_reconcile-0.10.1rc1200.dist-info/RECORD,,
@@ -18,6 +18,7 @@ from reconcile.external_resources.model import (
18
18
  ExternalResource,
19
19
  ExternalResourceKey,
20
20
  ExternalResourceModuleConfiguration,
21
+ ExternalResourceOrphanedResourcesError,
21
22
  ExternalResourcesInventory,
22
23
  ExternalResourceValidationError,
23
24
  ModuleInventory,
@@ -198,6 +199,13 @@ class ExternalResourcesManager:
198
199
  to_reconcile.add(r)
199
200
  return to_reconcile
200
201
 
202
+ def _check_orphaned_objects(self) -> None:
203
+ state_keys = self.state_mgr.get_all_resource_keys()
204
+ inventory_keys = set(self.er_inventory.keys())
205
+ orphans = state_keys - inventory_keys
206
+ if len(orphans) > 0:
207
+ raise ExternalResourceOrphanedResourcesError(orphans)
208
+
201
209
  def _get_reconciliation_status(
202
210
  self,
203
211
  r: Reconciliation,
@@ -364,6 +372,7 @@ class ExternalResourcesManager:
364
372
  self._sync_secrets(to_sync_keys=to_sync_keys | pending_sync_keys)
365
373
 
366
374
  def handle_dry_run_resources(self) -> None:
375
+ self._check_orphaned_objects()
367
376
  desired_r = self._get_desired_objects_reconciliations()
368
377
  deleted_r = self._get_deleted_objects_reconciliations()
369
378
  reconciliations = desired_r.union(deleted_r)
@@ -34,6 +34,17 @@ from reconcile.utils.external_resource_spec import (
34
34
  )
35
35
 
36
36
 
37
+ class ExternalResourceOrphanedResourcesError(Exception):
38
+ def __init__(self, orphans: Iterable["ExternalResourceKey"]) -> None:
39
+ msg = [
40
+ "There are orphaned resources in the configuration. ",
41
+ "To delete ERv2 managed external resources, set the 'delete: true' attribute.\n",
42
+ "Orphans:\n",
43
+ "\n".join(map(str, orphans)),
44
+ ]
45
+ super().__init__("".join(msg))
46
+
47
+
37
48
  class ExternalResourceValidationError(Exception):
38
49
  errors: list[str] = []
39
50