qontract-reconcile 0.10.1rc463__py3-none-any.whl → 0.10.1rc464__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.1rc463
3
+ Version: 0.10.1rc464
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
@@ -159,7 +159,7 @@ reconcile/glitchtip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
159
159
  reconcile/glitchtip/integration.py,sha256=FB1dmwrDs8z6MHfO5Za83fcPkxsVvcaw6sFymIx4C_Q,8116
160
160
  reconcile/glitchtip/reconciler.py,sha256=XybVNqXFnrPbNEX_B1B7esqExWdWNsUPXaORMPRUbfk,12333
161
161
  reconcile/glitchtip_project_alerts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
- reconcile/glitchtip_project_alerts/integration.py,sha256=k9XiGP8faKNQwc_V2DgmnWCG1FS-zV-wDT2uIMZKN4o,11092
162
+ reconcile/glitchtip_project_alerts/integration.py,sha256=Bb4X-oEeBxLQtVJM4TZSerQKgDTknAWO_f-7LZRVGnI,11778
163
163
  reconcile/glitchtip_project_dsn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
164
164
  reconcile/glitchtip_project_dsn/integration.py,sha256=NSHW3qVwkeSMv7Anl6fb-UFKRLUh_dh7JfvPQVvg1cA,7946
165
165
  reconcile/gql_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -646,8 +646,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
646
646
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
647
647
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
648
648
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
649
- qontract_reconcile-0.10.1rc463.dist-info/METADATA,sha256=Nukl4j9tp1zU4A32fGz35inNKbWMOETaQLdXS7AXMlM,2348
650
- qontract_reconcile-0.10.1rc463.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
651
- qontract_reconcile-0.10.1rc463.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
652
- qontract_reconcile-0.10.1rc463.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
653
- qontract_reconcile-0.10.1rc463.dist-info/RECORD,,
649
+ qontract_reconcile-0.10.1rc464.dist-info/METADATA,sha256=_spKRy37Hm4dn6vMeiwg6fNOmNbAbhcp4ZeWeeU7Go4,2348
650
+ qontract_reconcile-0.10.1rc464.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
651
+ qontract_reconcile-0.10.1rc464.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
652
+ qontract_reconcile-0.10.1rc464.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
653
+ qontract_reconcile-0.10.1rc464.dist-info/RECORD,,
@@ -46,6 +46,18 @@ class GlitchtipProjectAlertsIntegrationParams(PydanticRunParams):
46
46
  instance: Optional[str] = None
47
47
 
48
48
 
49
+ def webhook_urls_are_unique(alerts: Iterable[ProjectAlert]) -> bool:
50
+ """Check that webhook URLs are unique across a project."""
51
+ urls = []
52
+ for alert in alerts:
53
+ for recipient in alert.recipients:
54
+ if recipient.recipient_type == RecipientType.WEBHOOK:
55
+ if recipient.url in urls:
56
+ return False
57
+ urls.append(recipient.url)
58
+ return True
59
+
60
+
49
61
  class GlitchtipProjectAlertsIntegration(
50
62
  QontractReconcileIntegration[GlitchtipProjectAlertsIntegrationParams]
51
63
  ):
@@ -137,6 +149,11 @@ class GlitchtipProjectAlertsIntegration(
137
149
  ],
138
150
  )
139
151
  )
152
+ # check for duplicates
153
+ if not webhook_urls_are_unique(alerts):
154
+ raise ValueError(
155
+ "Glitchtip project alert webhook URLs must be unique across a project. Do not trigger the same webhook twice."
156
+ )
140
157
  project = Project(
141
158
  name=glitchtip_project.name,
142
159
  platform=None,