qontract-reconcile 0.10.1rc998__py3-none-any.whl → 0.10.1rc999__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.1rc998
3
+ Version: 0.10.1rc999
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
@@ -243,6 +243,7 @@ reconcile/gql_definitions/common/app_interface_dms_settings.py,sha256=h-N7-XGpmH
243
243
  reconcile/gql_definitions/common/app_interface_repo_settings.py,sha256=rud0rz9NIFF-h1fFdk3MnwGmx73rhwrn1taN_HefvyU,1754
244
244
  reconcile/gql_definitions/common/app_interface_state_settings.py,sha256=VXIK0Hmyv6GTShI86IGkjxyHGwufqUBAh617XKUAKaI,2507
245
245
  reconcile/gql_definitions/common/app_interface_vault_settings.py,sha256=w8quvdG0cSq71ZyJokPPp7MyMpoDb6-HLQ3o9JHVGRQ,1771
246
+ reconcile/gql_definitions/common/app_quay_repos_escalation_policies.py,sha256=Nnl5ZSHukf0mux_Kfu_qSsTCQ6e9guytZTAApMRWz6Y,3050
246
247
  reconcile/gql_definitions/common/aws_vpc_requests.py,sha256=2lpyy-QSfHPSTvV_zbnqzqUoFzVNl-CJDmoqd_zVSX4,2366
247
248
  reconcile/gql_definitions/common/aws_vpcs.py,sha256=Dss9dQ3xagnz3Ltg1e9mtG2PAmQGBbUzKCmmzvuN28s,1892
248
249
  reconcile/gql_definitions/common/clusters.py,sha256=Dr5AsSsTuqjAxkI9fU0fdiaP6u5qkmRpkkCcYDnU584,21868
@@ -592,6 +593,7 @@ reconcile/typed_queries/app_interface_deadmanssnitch_settings.py,sha256=_PpC3IM_
592
593
  reconcile/typed_queries/app_interface_repo_url.py,sha256=9fhgWihjWNYOmK65irBWw9jdm7YPJNUWqZC1Ez__PFc,578
593
594
  reconcile/typed_queries/app_interface_state_settings.py,sha256=GdtxrjKs6JONthBzXJO66wHx80v3YyHvbZScj0XFM1Q,447
594
595
  reconcile/typed_queries/app_interface_vault_settings.py,sha256=ffkKVDD5cukQWOorUIrGvpcVr3lCbUHRIz0HWX_h7gI,715
596
+ reconcile/typed_queries/app_quay_repos_escalation_policies.py,sha256=qpO9z9ev2RSH8sdZprLxhhrrbI0kvzmliSPfIVnfPbE,397
595
597
  reconcile/typed_queries/aws_vpc_requests.py,sha256=3LmBX9usfK8Uqr-pAux2oap01sXiMdGC_ihln6w4oV8,358
596
598
  reconcile/typed_queries/aws_vpcs.py,sha256=Fd0QCwXOH46UHw3-Xo_1ghtGYgUVJDpKf5Q3r1GpJGI,339
597
599
  reconcile/typed_queries/cloudflare.py,sha256=jOsqgCzMrjomPaIWc1isTcQAGONmMIJDTBcpmCheonA,308
@@ -823,7 +825,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
823
825
  tools/app_interface_reporter.py,sha256=1ZP58LYV6ww3XOLVxgy8NKasMb1jQmp4BNqzTEB0VBE,17723
824
826
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
825
827
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
826
- tools/qontract_cli.py,sha256=w_z2WAfPxXRXm8jbrg-Vc95sIYbPxVu3lCR14lEK3J4,125855
828
+ tools/qontract_cli.py,sha256=UC03zpZPnKu8M2CUmdaghhpN9ji4UYLQtr25hLnHAvg,126922
827
829
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
828
830
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
829
831
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -854,8 +856,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
854
856
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
855
857
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
856
858
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
857
- qontract_reconcile-0.10.1rc998.dist-info/METADATA,sha256=C-FKJi66DUTRsEPvxIam7tbqEn2MiaX4Of5mxG-eYhA,2262
858
- qontract_reconcile-0.10.1rc998.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
859
- qontract_reconcile-0.10.1rc998.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
860
- qontract_reconcile-0.10.1rc998.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
861
- qontract_reconcile-0.10.1rc998.dist-info/RECORD,,
859
+ qontract_reconcile-0.10.1rc999.dist-info/METADATA,sha256=enfD2JTSaUoouoeieJwg_fjf-OzHHSLEBR7icP_Nk1Y,2262
860
+ qontract_reconcile-0.10.1rc999.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
861
+ qontract_reconcile-0.10.1rc999.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
862
+ qontract_reconcile-0.10.1rc999.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
863
+ qontract_reconcile-0.10.1rc999.dist-info/RECORD,,
@@ -0,0 +1,112 @@
1
+ """
2
+ Generated by qenerate plugin=pydantic_v1. DO NOT MODIFY MANUALLY!
3
+ """
4
+ from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
+ from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
+ from enum import Enum # noqa: F401 # pylint: disable=W0611
7
+ from typing import ( # noqa: F401 # pylint: disable=W0611
8
+ Any,
9
+ Optional,
10
+ Union,
11
+ )
12
+
13
+ from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
+ BaseModel,
15
+ Extra,
16
+ Field,
17
+ Json,
18
+ )
19
+
20
+
21
+ DEFINITION = """
22
+ query AppQuayReposEscalationPolicies {
23
+ apps: apps_v1 {
24
+ name
25
+ escalationPolicy {
26
+ channels {
27
+ email
28
+ slackUserGroup {
29
+ handle
30
+ }
31
+ }
32
+ }
33
+ quayRepos {
34
+ org {
35
+ name
36
+ }
37
+ items {
38
+ name
39
+ mirror {
40
+ path
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ """
47
+
48
+
49
+ class ConfiguredBaseModel(BaseModel):
50
+ class Config:
51
+ smart_union=True
52
+ extra=Extra.forbid
53
+
54
+
55
+ class PermissionSlackUsergroupV1(ConfiguredBaseModel):
56
+ handle: str = Field(..., alias="handle")
57
+
58
+
59
+ class AppEscalationPolicyChannelsV1(ConfiguredBaseModel):
60
+ email: list[str] = Field(..., alias="email")
61
+ slack_user_group: list[PermissionSlackUsergroupV1] = Field(..., alias="slackUserGroup")
62
+
63
+
64
+ class AppEscalationPolicyV1(ConfiguredBaseModel):
65
+ channels: AppEscalationPolicyChannelsV1 = Field(..., alias="channels")
66
+
67
+
68
+ class QuayOrgV1(ConfiguredBaseModel):
69
+ name: str = Field(..., alias="name")
70
+
71
+
72
+ class ContainerImageMirrorV1(ConfiguredBaseModel):
73
+ path: str = Field(..., alias="path")
74
+
75
+
76
+ class AppQuayReposItemsV1(ConfiguredBaseModel):
77
+ name: str = Field(..., alias="name")
78
+ mirror: Optional[ContainerImageMirrorV1] = Field(..., alias="mirror")
79
+
80
+
81
+ class AppQuayReposV1(ConfiguredBaseModel):
82
+ org: QuayOrgV1 = Field(..., alias="org")
83
+ items: list[AppQuayReposItemsV1] = Field(..., alias="items")
84
+
85
+
86
+ class AppV1(ConfiguredBaseModel):
87
+ name: str = Field(..., alias="name")
88
+ escalation_policy: AppEscalationPolicyV1 = Field(..., alias="escalationPolicy")
89
+ quay_repos: Optional[list[AppQuayReposV1]] = Field(..., alias="quayRepos")
90
+
91
+
92
+ class AppQuayReposEscalationPoliciesQueryData(ConfiguredBaseModel):
93
+ apps: Optional[list[AppV1]] = Field(..., alias="apps")
94
+
95
+
96
+ def query(query_func: Callable, **kwargs: Any) -> AppQuayReposEscalationPoliciesQueryData:
97
+ """
98
+ This is a convenience function which queries and parses the data into
99
+ concrete types. It should be compatible with most GQL clients.
100
+ You do not have to use it to consume the generated data classes.
101
+ Alternatively, you can also mime and alternate the behavior
102
+ of this function in the caller.
103
+
104
+ Parameters:
105
+ query_func (Callable): Function which queries your GQL Server
106
+ kwargs: optional arguments that will be passed to the query function
107
+
108
+ Returns:
109
+ AppQuayReposEscalationPoliciesQueryData: queried data parsed into generated classes
110
+ """
111
+ raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
112
+ return AppQuayReposEscalationPoliciesQueryData(**raw_data)
@@ -0,0 +1,14 @@
1
+ from reconcile.gql_definitions.common.app_quay_repos_escalation_policies import (
2
+ AppV1,
3
+ query,
4
+ )
5
+ from reconcile.utils import gql
6
+ from reconcile.utils.gql import GqlApi
7
+
8
+
9
+ def get_apps_quay_repos_escalation_policies(
10
+ gql_api: GqlApi | None = None,
11
+ ) -> list[AppV1]:
12
+ api = gql_api if gql_api else gql.get_api()
13
+ data = query(query_func=api.query)
14
+ return list(data.apps or [])
tools/qontract_cli.py CHANGED
@@ -80,6 +80,9 @@ from reconcile.typed_queries.alerting_services_settings import get_alerting_serv
80
80
  from reconcile.typed_queries.app_interface_vault_settings import (
81
81
  get_app_interface_vault_settings,
82
82
  )
83
+ from reconcile.typed_queries.app_quay_repos_escalation_policies import (
84
+ get_apps_quay_repos_escalation_policies,
85
+ )
83
86
  from reconcile.typed_queries.clusters import get_clusters
84
87
  from reconcile.typed_queries.external_resources import (
85
88
  get_modules,
@@ -2843,6 +2846,33 @@ You can view the source of this Markdown to extract the JSON data.
2843
2846
  print_output(ctx.obj["options"], results, columns)
2844
2847
 
2845
2848
 
2849
+ @get.command
2850
+ @click.pass_context
2851
+ def container_image_details(ctx):
2852
+ apps = get_apps_quay_repos_escalation_policies()
2853
+ data: list[dict[str, str]] = []
2854
+ for app in apps:
2855
+ app_name = app.name
2856
+ ep_channels = app.escalation_policy.channels
2857
+ email = ep_channels.email
2858
+ slack = ep_channels.slack_user_group[0].handle
2859
+ for org_items in app.quay_repos or []:
2860
+ org_name = org_items.org.name
2861
+ for repo in org_items.items or []:
2862
+ if repo.mirror:
2863
+ continue
2864
+ repository = f"quay.io/{org_name}/{repo.name}"
2865
+ item = {
2866
+ "app": app_name,
2867
+ "repository": repository,
2868
+ "email": email,
2869
+ "slack": slack,
2870
+ }
2871
+ data.append(item)
2872
+ columns = ["app", "repository", "email", "slack"]
2873
+ print_output(ctx.obj["options"], data, columns)
2874
+
2875
+
2846
2876
  @root.group(name="set")
2847
2877
  @output
2848
2878
  @click.pass_context