qontract-reconcile 0.10.2.dev169__py3-none-any.whl → 0.10.2.dev171__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev169
3
+ Version: 0.10.2.dev171
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -104,7 +104,7 @@ reconcile/saas_file_validator.py,sha256=tyvFYU6lnkfDYIkAIr5pWqSvO5Yc6TagZ-quJYD2
104
104
  reconcile/sendgrid_teammates.py,sha256=oO8QbLb4s1o8A6CGiCagN9CmS05BSS_WLztuY0Ym9D8,4773
105
105
  reconcile/service_dependencies.py,sha256=SOSJvSo6GchQpLsTbkGFnf1yHtlSFu2VnirAfi6-XGA,4418
106
106
  reconcile/signalfx_endpoint_monitoring.py,sha256=Nqgsg1cflSd2nNnm89y_e8c--7xLUqTrKOHkDs-qADE,2868
107
- reconcile/slack_base.py,sha256=8FqwMJ5SkoRyDJ9iPfZogWkC9QRoTouMCnGUevV_GME,3447
107
+ reconcile/slack_base.py,sha256=I-msunWxfgu5bSwXYulGbtLjxUB_tRmTCAUCU-3nabI,3484
108
108
  reconcile/slack_usergroups.py,sha256=vMifpbnrQDLeckGtUmpIg7sVvlhpaJz8HZH_loA7fpY,30221
109
109
  reconcile/sql_query.py,sha256=OEzEZaqgv-kzG3GR2x9w3uMIfSFXP6EdhlW4u5mc1Dg,25895
110
110
  reconcile/status.py,sha256=cY4IJFXemhxptRJqR4qaaOWqei9e4jgLXuVSGajMsjg,544
@@ -659,7 +659,7 @@ reconcile/utils/ruamel.py,sha256=FzL4_L0FnMOUZmgThrZSMJs5MTdXwiy-E9MZWfk8bh8,397
659
659
  reconcile/utils/secret_reader.py,sha256=MaP56KZaAE35EyYbgAitdm6fUSxdzWeGFSOym9qiZkw,10206
660
660
  reconcile/utils/semver_helper.py,sha256=-WfPOMSA2v1h7hT3PwVf-Htg7wOsoKlQC1JdmDX2Ars,1268
661
661
  reconcile/utils/sharding.py,sha256=DDBHfs5TT9UgjmzewiXUjbncnrPuceAZWeOA4veGa7s,843
662
- reconcile/utils/slack_api.py,sha256=iaOFzv3wiZRhcgYK2NB4lsG6ymNsGk2MEuj0PgZVp7w,17355
662
+ reconcile/utils/slack_api.py,sha256=CKHjO1EyNpJsqZYEnN5uRMVF-soTCYwUma_Th4enHSo,17507
663
663
  reconcile/utils/slo_document_manager.py,sha256=CPgM2oH4AVzBqenakWo59R5yfwB62tnxSnSOHgir7l8,9500
664
664
  reconcile/utils/smtp_client.py,sha256=0xefB4I9E5eBB-FlxFJYjvz3Kvuqi_K3Ma_Wk0NAQKM,2779
665
665
  reconcile/utils/sqs_gateway.py,sha256=XNIf3PY4UCPNufP2Ul0UJj3fKlt5larBba-VTT-41Fg,2265
@@ -759,9 +759,9 @@ reconcile/utils/runtime/meta.py,sha256=dWdKS9eHVuowFkTK4lgXJ723vS1y9giOMzePUKnHn
759
759
  reconcile/utils/runtime/runner.py,sha256=I30KRrX1UQbHc_Ir1cIZX3OfNSdoHKdnDSPAEB69Ilk,7944
760
760
  reconcile/utils/runtime/sharding.py,sha256=r0ieUtNed7NvknSw6qQrCkKpVXE1shuHGnfFcnpA_k4,16142
761
761
  reconcile/utils/saasherder/__init__.py,sha256=3U8plqMAPRE1kjwZ5YnIsYsggTf4_gS7flRUEuXVBAs,343
762
- reconcile/utils/saasherder/interfaces.py,sha256=2Fjc34Us5q166P6bWVmSEBeYNTnWAPrI9EHwYUnEeuw,9098
762
+ reconcile/utils/saasherder/interfaces.py,sha256=NEYQspYfyWQhBeJyNCqSFbixi1A4wRVGB7FeNM5BDCk,9141
763
763
  reconcile/utils/saasherder/models.py,sha256=JaOz_DEtudJZhiDe90kaBlJkppFufn81V92oK9PHYx0,10208
764
- reconcile/utils/saasherder/saasherder.py,sha256=13LeAw12QR7wg4eU92iDsNXTCSCBrBp6LKvACn8ndp0,86834
764
+ reconcile/utils/saasherder/saasherder.py,sha256=ZeYwUSrWbJ0XkmQv92dUGPrhxd5zBKnDEM7_uzRroFE,87067
765
765
  reconcile/utils/terraform/__init__.py,sha256=zNbiyTWo35AT1sFTElL2j_AA0jJ_yWE_bfFn-nD2xik,250
766
766
  reconcile/utils/terraform/config.py,sha256=5UVrd563TMcvi4ooa5JvWVDW1I3bIWg484u79evfV_8,164
767
767
  reconcile/utils/terraform/config_client.py,sha256=gRL1rQ0AqvShei_rcGqC3HDYGskOFKE1nPrJyJE9yno,4676
@@ -774,14 +774,14 @@ reconcile/utils/unleash/__init__.py,sha256=2PsN3GlLU8DOyWSvv5q9uzwuFn_vYtfEo-mmV
774
774
  reconcile/utils/unleash/client.py,sha256=YrJnauxjcy1ml7W2AHg7dzIH_fVK_GugoRu7IFmk6e0,3505
775
775
  reconcile/utils/unleash/server.py,sha256=907gDh9Ee8UxLqusnfpzE-7LUnttB38D4xhVJ0vMf_M,4439
776
776
  tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
777
+ tools/alert_report.py,sha256=PqhFD2Yy_-dYCCSdNjoXbU6-FxbKnxCLLbcgjWmePhE,5051
777
778
  tools/app_interface_metrics_exporter.py,sha256=f1qwTmQfEcs98uBVRyBa0k7GQXdiSwd7w1hDVjhdGcQ,2303
778
779
  tools/app_interface_reporter.py,sha256=0_oq1-mL0UOh1x5G8CoKaEVJqK-XTKE7PX7IbRTovBc,17224
779
780
  tools/app_sre_tekton_access_reporter.py,sha256=o9prLUgQpwO3msRWc2as1xT1y9OB3znkpgvLr0Ys8_M,3146
780
781
  tools/app_sre_tekton_access_revalidation.py,sha256=66nHEaY-bIqxIhpcmwN8AvQZu6ZXenfkg4Fut0pVZRM,2726
781
782
  tools/glitchtip_access_reporter.py,sha256=o01A6b88t3Wie6tj_tJWWVo2J01LxQ_a9giGm4UzEaU,2901
782
783
  tools/glitchtip_access_revalidation.py,sha256=PXN5wxl6OX8sxddPaakDF3X79nFLvpm-lz0mWLVelw0,2806
783
- tools/qontract_cli.py,sha256=rmR4aUIghazzRPoxTcKY2YCZWKmYqpvwhS-p-uoeL-4,157549
784
- tools/sd_app_sre_alert_report.py,sha256=jQpJdXVID68bSNtJNOGDh0-ei1CfEUS4Itr4MAaBNFA,5062
784
+ tools/qontract_cli.py,sha256=pSN7UAWiI4lpOe_UHPWTBNG9adDLsJ5ZtcaIap0ChYg,157687
785
785
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
786
786
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
787
787
  tools/cli_commands/container_images_report.py,sha256=SXh6sZ1dXXzd-2R5eeBufCtW3J4-Y55--0MZLdo4lr8,5409
@@ -807,7 +807,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
807
807
  tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
808
808
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
809
809
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
810
- qontract_reconcile-0.10.2.dev169.dist-info/METADATA,sha256=4jU4ZsBrELF7np1OLiyWn5SGED63Y6QaiZhwOVGyvh4,24627
811
- qontract_reconcile-0.10.2.dev169.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
812
- qontract_reconcile-0.10.2.dev169.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
813
- qontract_reconcile-0.10.2.dev169.dist-info/RECORD,,
810
+ qontract_reconcile-0.10.2.dev171.dist-info/METADATA,sha256=Aks0nz4e_e3-ZxjlfMkisaMEtonPhEgTNUcCUhgONOA,24627
811
+ qontract_reconcile-0.10.2.dev171.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
812
+ qontract_reconcile-0.10.2.dev171.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
813
+ qontract_reconcile-0.10.2.dev171.dist-info/RECORD,,
reconcile/slack_base.py CHANGED
@@ -14,12 +14,12 @@ from reconcile.utils.slack_api import (
14
14
 
15
15
 
16
16
  def slackapi_from_queries(
17
- integration_name: str, init_usergroups: bool = True
17
+ integration_name: str, init_usergroups: bool = True, channel: str | None = None
18
18
  ) -> SlackApi:
19
19
  secret_reader = SecretReader(queries.get_secret_reader_settings())
20
20
  slack_workspace = {"workspace": queries.get_slack_workspace()}
21
21
  return slackapi_from_slack_workspace(
22
- slack_workspace, secret_reader, integration_name, init_usergroups
22
+ slack_workspace, secret_reader, integration_name, init_usergroups, channel
23
23
  )
24
24
 
25
25
 
@@ -367,6 +367,8 @@ class ManagedResourceName(Protocol):
367
367
  resource: str
368
368
  resource_names: list[str]
369
369
 
370
+ def dict(self) -> dict[str, str]: ...
371
+
370
372
 
371
373
  class SaasFile(HasParameters, HasSecretParameters, Protocol):
372
374
  path: str
@@ -1784,6 +1784,11 @@ class SaasHerder: # pylint: disable=too-many-public-methods
1784
1784
  desired_target_config["saas_file_managed_resource_types"] = (
1785
1785
  saas_file.managed_resource_types
1786
1786
  )
1787
+ if saas_file.managed_resource_names:
1788
+ desired_target_config["saas_file_managed_resource_names"] = [
1789
+ m.dict() for m in saas_file.managed_resource_names
1790
+ ]
1791
+
1787
1792
  desired_target_config["url"] = rt.url
1788
1793
  desired_target_config["path"] = rt.path
1789
1794
  # before the GQL classes are introduced, the parameters attribute
@@ -491,6 +491,8 @@ class SlackApi:
491
491
  from_timestamp to to_timestamp ignoring threads"""
492
492
  if not self.channel:
493
493
  raise ValueError("Expecting self.channel to be set")
494
+ channels_found = self.get_channels_by_names(self.channel)
495
+ [channel_id] = [k for k in channels_found if channels_found[k] == self.channel]
494
496
 
495
497
  cursor = ""
496
498
  responses = []
@@ -499,7 +501,7 @@ class SlackApi:
499
501
  slack_request.labels("conversations.history", "GET").inc()
500
502
 
501
503
  response = self._sc.conversations_history(
502
- cursor=cursor, channel=self.channel, **self.chat_kwargs
504
+ cursor=cursor, channel=channel_id, **self.chat_kwargs
503
505
  )
504
506
 
505
507
  for r in response["messages"]:
@@ -3,7 +3,7 @@ import re
3
3
  from collections import defaultdict
4
4
  from dataclasses import dataclass
5
5
 
6
- QONTRACT_INTEGRATION = "sd-app-sre-alert-report"
6
+ QONTRACT_INTEGRATION = "alert-report"
7
7
 
8
8
 
9
9
  @dataclass
tools/qontract_cli.py CHANGED
@@ -798,6 +798,11 @@ def ocm_addon_upgrade_policies(ctx: click.core.Context) -> None:
798
798
 
799
799
 
800
800
  @get.command()
801
+ @click.option(
802
+ "--channel",
803
+ help="Specifies the channel that alerts stores",
804
+ type=str,
805
+ )
801
806
  @click.option(
802
807
  "--days",
803
808
  help="Days to consider for the report. Cannot be used with timestamp options.",
@@ -816,13 +821,14 @@ def ocm_addon_upgrade_policies(ctx: click.core.Context) -> None:
816
821
  type=int,
817
822
  )
818
823
  @click.pass_context
819
- def sd_app_sre_alert_report(
824
+ def alert_report(
820
825
  ctx: click.core.Context,
826
+ channel: str | None,
821
827
  days: int | None,
822
828
  from_timestamp: int | None,
823
829
  to_timestamp: int | None,
824
830
  ) -> None:
825
- import tools.sd_app_sre_alert_report as report
831
+ import tools.alert_report as report
826
832
 
827
833
  if days:
828
834
  if from_timestamp or to_timestamp:
@@ -845,7 +851,9 @@ def sd_app_sre_alert_report(
845
851
  sys.exit(1)
846
852
 
847
853
  slack = slackapi_from_queries(
848
- integration_name=report.QONTRACT_INTEGRATION, init_usergroups=False
854
+ integration_name=report.QONTRACT_INTEGRATION,
855
+ init_usergroups=False,
856
+ channel=channel,
849
857
  )
850
858
  alerts = report.group_alerts(
851
859
  slack.get_flat_conversation_history(