qontract-reconcile 0.10.1rc839__py3-none-any.whl → 0.10.1rc841__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.1rc839
3
+ Version: 0.10.1rc841
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
@@ -232,7 +232,7 @@ reconcile/gql_definitions/cna/queries/cna_provisioners.py,sha256=4k527BszdWB84Wk
232
232
  reconcile/gql_definitions/cna/queries/cna_resources.py,sha256=j9sa5iOOBsLT2qwlmEItnafSXK-vdNPXgd9Z4mg9mlc,2710
233
233
  reconcile/gql_definitions/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
234
  reconcile/gql_definitions/common/alerting_services_settings.py,sha256=mT7cobC9mR_bhFSYeQX1apVA5zMqSbu5fYcdd4iZ9mg,1802
235
- reconcile/gql_definitions/common/app_code_component_repos.py,sha256=eGlv8SRiLl-QUYNDl_gAvtQGMB2Hr31EqUXYQO_wOcg,1835
235
+ reconcile/gql_definitions/common/app_code_component_repos.py,sha256=4I4hQ37rkAYh9HlJdE9eKBtML-82jY8qHkXhbCZCtmM,1951
236
236
  reconcile/gql_definitions/common/app_interface_custom_messages.py,sha256=5a-rmQqR0qmews01K1WiTw1ZHUIUmQoznF9v8_Uw9QQ,2000
237
237
  reconcile/gql_definitions/common/app_interface_dms_settings.py,sha256=h-N7-XGpmH7O9d3UBPhJJl48tpZvqihLloamZKdlgVg,2568
238
238
  reconcile/gql_definitions/common/app_interface_repo_settings.py,sha256=rud0rz9NIFF-h1fFdk3MnwGmx73rhwrn1taN_HefvyU,1754
@@ -603,7 +603,7 @@ reconcile/typed_queries/namespaces_minimal.py,sha256=rUtqNQ0ORXXUTQfnpsMURymAJ4g
603
603
  reconcile/typed_queries/ocm.py,sha256=aTXW9NaMpMq-90sBUAUQmGPtk6Hnsk2rzSbXv3pD8dY,312
604
604
  reconcile/typed_queries/pagerduty_instances.py,sha256=QCHqEAakiH6eSob0Pnnn3IBd8Ga0zpEp1Z6Qu3v2uH4,733
605
605
  reconcile/typed_queries/quay.py,sha256=OvkSDDbS3o4a4W5MqVxTAVmo47p5XegeoEVNiuqsevg,242
606
- reconcile/typed_queries/repos.py,sha256=RKBsf7IDS6NsXTtXxJ9Ol9G3bxG9sr3vW9QQ2bahEHo,512
606
+ reconcile/typed_queries/repos.py,sha256=9I2rJ5VrwB1boJEuaa8A3QWJ1N7wMVbkwfgFadfSrwo,858
607
607
  reconcile/typed_queries/reserved_networks.py,sha256=SWukbbEeW6acyP89v0DYd1WgbcBlUDuo-y3e27eN_vs,390
608
608
  reconcile/typed_queries/saas_files.py,sha256=4b6zhb5-y7HUyn9DDkJ9CRpvg7N-PnH6gtXtHyd-rzo,14136
609
609
  reconcile/typed_queries/slack.py,sha256=r30lspctHloyygPn8_DVybxPwUWwiBpvBRRXiTVcQYk,251
@@ -811,7 +811,7 @@ tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB
811
811
  tools/template_validation.py,sha256=-U-lTGeLaci8yWPEblCJeev2DOlY1jM9QOOh-O1zts8,3376
812
812
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
813
813
  tools/cli_commands/gpg_encrypt.py,sha256=w8hl4jIEWk5wKbEFN6fVEOwUJGmdlvOqYodW3XSN7mU,4978
814
- tools/cli_commands/systems_and_tools.py,sha256=k38KN10FD-YWCJq3g_ifMUKKLSUMtkI2mWj48l7f7Vk,10451
814
+ tools/cli_commands/systems_and_tools.py,sha256=welsQO8ccDIeMm_1D_7MOMV7jtIQHz21kCpvq6EQEi0,11080
815
815
  tools/cli_commands/cost_report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
816
816
  tools/cli_commands/cost_report/aws.py,sha256=bdvbT3bDymBOMx4Ve4kt154MeGiGusTSpOpMMFrQ4SM,5191
817
817
  tools/cli_commands/cost_report/cost_management_api.py,sha256=tFzjaZ3RSVJeAUsfSWXHiQlMVbV8dFcXibK158ODQcA,2549
@@ -834,8 +834,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
834
834
  tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
835
835
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
836
836
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
837
- qontract_reconcile-0.10.1rc839.dist-info/METADATA,sha256=6fv9DaKZrF-noChsztXOxgop9F-wAGR8yEbE015Yj4M,2275
838
- qontract_reconcile-0.10.1rc839.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
839
- qontract_reconcile-0.10.1rc839.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
840
- qontract_reconcile-0.10.1rc839.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
841
- qontract_reconcile-0.10.1rc839.dist-info/RECORD,,
837
+ qontract_reconcile-0.10.1rc841.dist-info/METADATA,sha256=q7YIqqm9VGJzFsTqTlhLX_DUD_SnKGOas3-t_7ddQgA,2275
838
+ qontract_reconcile-0.10.1rc841.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
839
+ qontract_reconcile-0.10.1rc841.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
840
+ qontract_reconcile-0.10.1rc841.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
841
+ qontract_reconcile-0.10.1rc841.dist-info/RECORD,,
@@ -22,6 +22,8 @@ DEFINITION = """
22
22
  query AppCodeComponentRepos {
23
23
  apps: apps_v1 {
24
24
  codeComponents {
25
+ name
26
+ resource
25
27
  url
26
28
  }
27
29
  }
@@ -36,6 +38,8 @@ class ConfiguredBaseModel(BaseModel):
36
38
 
37
39
 
38
40
  class AppCodeComponentsV1(ConfiguredBaseModel):
41
+ name: str = Field(..., alias="name")
42
+ resource: str = Field(..., alias="resource")
39
43
  url: str = Field(..., alias="url")
40
44
 
41
45
 
@@ -1,17 +1,30 @@
1
1
  from collections.abc import Callable
2
2
  from typing import Optional
3
3
 
4
- from reconcile.gql_definitions.common.app_code_component_repos import query
4
+ from reconcile.gql_definitions.common.app_code_component_repos import (
5
+ AppCodeComponentsV1,
6
+ query,
7
+ )
5
8
  from reconcile.utils import gql
6
9
 
7
10
 
8
- def get_repos(
11
+ def get_code_components(
9
12
  server: str = "",
10
13
  query_func: Optional[Callable] = None,
11
- ) -> list[str]:
14
+ ) -> list[AppCodeComponentsV1]:
12
15
  if not query_func:
13
16
  query_func = gql.get_api().query
14
- repos: list[str] = []
17
+ code_components: list[AppCodeComponentsV1] = []
15
18
  for app in query(query_func).apps or []:
16
- repos += [c.url for c in app.code_components or [] if c.url.startswith(server)]
17
- return repos
19
+ code_components += [
20
+ c for c in app.code_components or [] if c.url.startswith(server)
21
+ ]
22
+ return code_components
23
+
24
+
25
+ def get_repos(
26
+ server: str = "",
27
+ query_func: Optional[Callable] = None,
28
+ ) -> list[str]:
29
+ code_components = get_code_components(server=server, query_func=query_func)
30
+ return [c.url for c in code_components]
@@ -8,6 +8,9 @@ from typing import (
8
8
 
9
9
  from pydantic import BaseModel
10
10
 
11
+ from reconcile.gql_definitions.common.app_code_component_repos import (
12
+ AppCodeComponentsV1,
13
+ )
11
14
  from reconcile.gql_definitions.common.clusters import ClusterV1
12
15
  from reconcile.gql_definitions.common.pagerduty_instances import (
13
16
  PagerDutyInstanceV1,
@@ -46,6 +49,7 @@ from reconcile.typed_queries.jira import get_jira_servers
46
49
  from reconcile.typed_queries.ocm import get_ocm_environments
47
50
  from reconcile.typed_queries.pagerduty_instances import get_pagerduty_instances
48
51
  from reconcile.typed_queries.quay import get_quay_instances
52
+ from reconcile.typed_queries.repos import get_code_components
49
53
  from reconcile.typed_queries.slack import get_slack_workspaces
50
54
  from reconcile.typed_queries.terraform_tgw_attachments.aws_accounts import (
51
55
  get_aws_accounts,
@@ -97,6 +101,8 @@ class SystemTool(BaseModel):
97
101
  return cls.init_from_vault_instance(model)
98
102
  case CloudflareAccountV1():
99
103
  return cls.init_from_cloudflare_account(model)
104
+ case AppCodeComponentsV1():
105
+ return cls.init_from_code_component(model)
100
106
  case _:
101
107
  raise NotImplementedError(f"unsupported: {model}")
102
108
 
@@ -250,6 +256,16 @@ class SystemTool(BaseModel):
250
256
  description=a.description,
251
257
  )
252
258
 
259
+ @classmethod
260
+ def init_from_code_component(cls, c: AppCodeComponentsV1) -> Self:
261
+ return cls(
262
+ system_type=c.resource,
263
+ system_id=c.name,
264
+ name=c.name,
265
+ url=c.url,
266
+ description=c.name,
267
+ )
268
+
253
269
 
254
270
  class SystemToolInventory:
255
271
  def __init__(self) -> None:
@@ -305,6 +321,9 @@ def get_systems_and_tools_inventory() -> SystemToolInventory:
305
321
  inventory.update(get_unleash_instances())
306
322
  inventory.update(get_vault_instances())
307
323
  inventory.update(get_cloudflare_accounts())
324
+ inventory.update([
325
+ c for c in get_code_components() if c.resource == "app-interface"
326
+ ])
308
327
 
309
328
  inventory.systems_and_tools.append(
310
329
  SystemTool(