qontract-reconcile 0.10.1rc581__py3-none-any.whl → 0.10.1rc583__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.1rc581
3
+ Version: 0.10.1rc583
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
@@ -199,6 +199,7 @@ reconcile/gql_definitions/cna/queries/cna_resources.py,sha256=j9sa5iOOBsLT2qwlmE
199
199
  reconcile/gql_definitions/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
200
200
  reconcile/gql_definitions/common/alerting_services_settings.py,sha256=mT7cobC9mR_bhFSYeQX1apVA5zMqSbu5fYcdd4iZ9mg,1802
201
201
  reconcile/gql_definitions/common/app_code_component_repos.py,sha256=eGlv8SRiLl-QUYNDl_gAvtQGMB2Hr31EqUXYQO_wOcg,1835
202
+ reconcile/gql_definitions/common/app_interface_custom_messages.py,sha256=5a-rmQqR0qmews01K1WiTw1ZHUIUmQoznF9v8_Uw9QQ,2000
202
203
  reconcile/gql_definitions/common/app_interface_repo_settings.py,sha256=rud0rz9NIFF-h1fFdk3MnwGmx73rhwrn1taN_HefvyU,1754
203
204
  reconcile/gql_definitions/common/app_interface_state_settings.py,sha256=VXIK0Hmyv6GTShI86IGkjxyHGwufqUBAh617XKUAKaI,2507
204
205
  reconcile/gql_definitions/common/app_interface_vault_settings.py,sha256=w8quvdG0cSq71ZyJokPPp7MyMpoDb6-HLQ3o9JHVGRQ,1771
@@ -332,7 +333,7 @@ reconcile/ldap_groups/integration.py,sha256=GscI7833EOEOiaySc2yKMg0u0hqzVJ3D3r27
332
333
  reconcile/ocm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
333
334
  reconcile/ocm/types.py,sha256=Q9vPQI3LpLajGtPqks7i36AV6CjRho96mmsTkdJrEWM,2477
334
335
  reconcile/ocm_internal_notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
335
- reconcile/ocm_internal_notifications/integration.py,sha256=LCwaBW39Dy8fe9RGMm7DkbRM2gQx_At0uTVMAxa8BQ4,4048
336
+ reconcile/ocm_internal_notifications/integration.py,sha256=6JFLu6TlcMC1OB5WgTAd-ITlhH_56W5uBytggukNk3A,4391
336
337
  reconcile/ocm_labels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
338
  reconcile/ocm_labels/integration.py,sha256=SqIgCYhlHEeoH2YXJ8kWIxCo9S3fzzAlZGxt9KCnJ1s,14792
338
339
  reconcile/ocm_labels/label_sources.py,sha256=z5Rg5uMTfRkTi3QbEQK1P82LLciWrSnp65XBEpZf2-o,1877
@@ -501,6 +502,7 @@ reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas
501
502
  reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_without_auto_promote.py,sha256=H3qQVfdu8huBXWooVjhXb7GyNTH6OyZcrJGW1_Smwnk,1981
502
503
  reconcile/typed_queries/__init__.py,sha256=rRk4CyslLsBr4vAh1pIPgt6s3P4R1M9NSEPLnyQgBpk,61
503
504
  reconcile/typed_queries/alerting_services_settings.py,sha256=sX6s8GY-BB0UHogMC1ICeREVab-IYrNm1c-hqMGEdYQ,864
505
+ reconcile/typed_queries/app_interface_custom_messages.py,sha256=5HWr68_kb4bEL8pDCIH0ez6GOrdwdbGF6w88xV0_Ccs,718
504
506
  reconcile/typed_queries/app_interface_repo_url.py,sha256=ePr_nvjDeyZPR4sHsDQFubV2gslj9lPUSzIWWhm0syo,609
505
507
  reconcile/typed_queries/app_interface_state_settings.py,sha256=ytNAf3feg8JwmdCC4vO1WtVb-Ok5_ZtNAL3mXe2d1Pw,479
506
508
  reconcile/typed_queries/app_interface_vault_settings.py,sha256=uFS7qLjjGnrK8gm2fkUT8RFd7s_5kxTWWpxZRhr1Ndo,746
@@ -684,8 +686,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
684
686
  tools/test/test_qontract_cli.py,sha256=EzJwaPxQw5CLPahLjh91oRT0pi1WCgOXZ_KgiNXZMAw,2948
685
687
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
686
688
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
687
- qontract_reconcile-0.10.1rc581.dist-info/METADATA,sha256=9BshBTZGlksoEAc6K5f6pSY-0L5ijSt_YOw0vSuzwqA,2349
688
- qontract_reconcile-0.10.1rc581.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
689
- qontract_reconcile-0.10.1rc581.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
690
- qontract_reconcile-0.10.1rc581.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
691
- qontract_reconcile-0.10.1rc581.dist-info/RECORD,,
689
+ qontract_reconcile-0.10.1rc583.dist-info/METADATA,sha256=rQtzBzP1rkgRUUXaDeyk2G06WdgpZEKpyL4FJx4F6EA,2349
690
+ qontract_reconcile-0.10.1rc583.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
691
+ qontract_reconcile-0.10.1rc583.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
692
+ qontract_reconcile-0.10.1rc583.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
693
+ qontract_reconcile-0.10.1rc583.dist-info/RECORD,,
@@ -0,0 +1,68 @@
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 AppInterfaceCustomMessages {
23
+ settings: app_interface_settings_v1 {
24
+ customMessages {
25
+ id
26
+ content
27
+ }
28
+ }
29
+ }
30
+ """
31
+
32
+
33
+ class ConfiguredBaseModel(BaseModel):
34
+ class Config:
35
+ smart_union=True
36
+ extra=Extra.forbid
37
+
38
+
39
+ class AppInterfaceCustomMessageV1(ConfiguredBaseModel):
40
+ q_id: str = Field(..., alias="id")
41
+ content: str = Field(..., alias="content")
42
+
43
+
44
+ class AppInterfaceSettingsV1(ConfiguredBaseModel):
45
+ custom_messages: Optional[list[AppInterfaceCustomMessageV1]] = Field(..., alias="customMessages")
46
+
47
+
48
+ class AppInterfaceCustomMessagesQueryData(ConfiguredBaseModel):
49
+ settings: Optional[list[AppInterfaceSettingsV1]] = Field(..., alias="settings")
50
+
51
+
52
+ def query(query_func: Callable, **kwargs: Any) -> AppInterfaceCustomMessagesQueryData:
53
+ """
54
+ This is a convenience function which queries and parses the data into
55
+ concrete types. It should be compatible with most GQL clients.
56
+ You do not have to use it to consume the generated data classes.
57
+ Alternatively, you can also mime and alternate the behavior
58
+ of this function in the caller.
59
+
60
+ Parameters:
61
+ query_func (Callable): Function which queries your GQL Server
62
+ kwargs: optional arguments that will be passed to the query function
63
+
64
+ Returns:
65
+ AppInterfaceCustomMessagesQueryData: queried data parsed into generated classes
66
+ """
67
+ raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
68
+ return AppInterfaceCustomMessagesQueryData(**raw_data)
@@ -12,6 +12,9 @@ from reconcile.gql_definitions.common.ocm_environments import (
12
12
  )
13
13
  from reconcile.gql_definitions.fragments.ocm_environment import OCMEnvironment
14
14
  from reconcile.slack_base import slackapi_from_queries
15
+ from reconcile.typed_queries.app_interface_custom_messages import (
16
+ get_app_interface_custom_message,
17
+ )
15
18
  from reconcile.utils import gql
16
19
  from reconcile.utils.ocm.search_filters import Filter
17
20
  from reconcile.utils.ocm_base_client import (
@@ -106,6 +109,12 @@ class OcmInternalNotifications(QontractReconcileIntegration[NoParams]):
106
109
 
107
110
  if not dry_run and slack_user_ids:
108
111
  users = " ".join([f"<@{uid}>" for uid in slack_user_ids])
112
+ instructions = (
113
+ get_app_interface_custom_message(
114
+ "ocm-internal-notifications-instructions"
115
+ )
116
+ or ""
117
+ )
109
118
  self.slack.chat_post_message(
110
- f"hey {users} :wave: you have clusters stuck in uninstalling state in the {env.name} environment"
119
+ f"hey {users} :wave: you have clusters stuck in uninstalling state in the {env.name} environment. {instructions}"
111
120
  )
@@ -0,0 +1,25 @@
1
+ from collections.abc import Callable
2
+ from typing import Optional
3
+
4
+ from reconcile.gql_definitions.common.app_interface_custom_messages import (
5
+ query,
6
+ )
7
+ from reconcile.utils import gql
8
+
9
+
10
+ def get_app_interface_custom_message(
11
+ desired_id: str,
12
+ query_func: Optional[Callable] = None,
13
+ ) -> Optional[str]:
14
+ """Returns App Interface Custom Message by ID or None if not found"""
15
+ if not query_func:
16
+ query_func = gql.get_api().query
17
+ data = query(query_func=query_func)
18
+ for item in (
19
+ data.settings[0].custom_messages
20
+ if data.settings and data.settings[0].custom_messages
21
+ else []
22
+ ):
23
+ if item.q_id == desired_id:
24
+ return item.content
25
+ return None