qontract-reconcile 0.10.1rc403__py3-none-any.whl → 0.10.1rc405__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.1rc403
3
+ Version: 0.10.1rc405
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
@@ -479,7 +479,7 @@ reconcile/typed_queries/terraform_tgw_attachments/aws_accounts.py,sha256=T5HSeyB
479
479
  reconcile/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
480
480
  reconcile/utils/aggregated_list.py,sha256=0wvfrjuFjyO1pblC1N9zTNq_4ihAiw0D7yguiNyQLjc,3330
481
481
  reconcile/utils/amtool.py,sha256=9p9FYkv4RYPnkDICuN1apcqJyZ5n8WbHF6vC0FIiQIw,2166
482
- reconcile/utils/aws_api.py,sha256=zr8NaB-8PT_k6yiLHRnjVat527RfvOR1DuD6-2bI5Zo,62586
482
+ reconcile/utils/aws_api.py,sha256=Bt_TtVM3FVWvVAJ-z-UclVYYZjWoXeA1UAJYzYqKcIE,63026
483
483
  reconcile/utils/aws_helper.py,sha256=E8NHkStoHRmvLVjRll2f5kGtU3i3f7ekp5V6nrn7B_M,1691
484
484
  reconcile/utils/binary.py,sha256=3IBnwjKakHM367skPPvG6yVSQYjKt5muQlFNdoa63DU,2352
485
485
  reconcile/utils/config.py,sha256=ZhYy3ZKI0vB_QvrYr14JPxu0EAVM5gS8cKRbM8ECRSE,992
@@ -612,7 +612,7 @@ tools/app_interface_reporter.py,sha256=8HUH8kkW50-plKgiTgCiFINJNN_cl4ZFzmY4aSnRa
612
612
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
613
613
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
614
614
  tools/qontract_cli.py,sha256=xEMgcF90wD9gak8JbYemKog0alh_usFhwwvyB356Ukw,97319
615
- tools/sd_app_sre_alert_report.py,sha256=utFZCreITuTZTiOaFNCaVPyFK0zxFZbc_ElcngGbiW8,4346
615
+ tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
616
616
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
617
617
  tools/cli_commands/gpg_encrypt.py,sha256=JryinrDdvztN931enUY3FuDeLVnfs6y58mnK7itNK6Y,4940
618
618
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
@@ -620,10 +620,10 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
620
620
  tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
621
621
  tools/test/test_app_interface_metrics_exporter.py,sha256=dmEcNwZltP1rd_4DbxIYakOCh0DHp8Trox3Z1N0Au3U,1293
622
622
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
623
- tools/test/test_sd_app_sre_alert_report.py,sha256=JeLhgzpKCPgLvptwg_4ZvJHLVWKNG1T5845HXTkMBxA,1826
623
+ tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
624
624
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
625
- qontract_reconcile-0.10.1rc403.dist-info/METADATA,sha256=cIo20x-baQGEabysu8S0LhYBh9G8h8NeNGF0KOyJhlU,2347
626
- qontract_reconcile-0.10.1rc403.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
627
- qontract_reconcile-0.10.1rc403.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
628
- qontract_reconcile-0.10.1rc403.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
629
- qontract_reconcile-0.10.1rc403.dist-info/RECORD,,
625
+ qontract_reconcile-0.10.1rc405.dist-info/METADATA,sha256=bIqWFa2YEDDCInJCzun3qZNNLuo-Ok-3ib1HmGEXccg,2347
626
+ qontract_reconcile-0.10.1rc405.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
627
+ qontract_reconcile-0.10.1rc405.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
628
+ qontract_reconcile-0.10.1rc405.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
629
+ qontract_reconcile-0.10.1rc405.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.41.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -20,6 +20,7 @@ from typing import (
20
20
 
21
21
  import botocore
22
22
  from boto3 import Session
23
+ from botocore.config import Config
23
24
  from pydantic import BaseModel
24
25
  from sretoolbox.utils import threaded
25
26
 
@@ -170,6 +171,13 @@ class AWSApi: # pylint: disable=too-many-public-methods
170
171
  access_key = secret["aws_access_key_id"]
171
172
  secret_key = secret["aws_secret_access_key"]
172
173
  region_name = account["resourcesDefaultRegion"]
174
+ self.use_fips = False
175
+
176
+ # ensure that govcloud accounts use FIPs endpoints
177
+ if "partition" in account and account["partition"] == GOVCLOUD_PARTITION:
178
+ logging.debug(f"FIPS endpoint enabled for AWS account: {account_name}")
179
+ self.use_fips = True
180
+
173
181
  session = Session(
174
182
  aws_access_key_id=access_key,
175
183
  aws_secret_access_key=secret_key,
@@ -203,7 +211,11 @@ class AWSApi: # pylint: disable=too-many-public-methods
203
211
  region_name: Optional[str] = None,
204
212
  ):
205
213
  region = region_name if region_name else session.region_name
206
- client = session.client(service_name, region_name=region)
214
+ client = session.client(
215
+ service_name,
216
+ region_name=region,
217
+ config=Config(use_fips_endpoint=self.use_fips),
218
+ )
207
219
  self._session_clients.append(client)
208
220
  return client
209
221
 
@@ -82,6 +82,21 @@ def group_alerts(messages: list[dict]) -> dict[str, list[Alert]]:
82
82
  )
83
83
  )
84
84
  else:
85
+ # This may happen for alerts rules without "message". This can happen
86
+ # if schema cannot be validated for a certain alert rule because it
87
+ # is not valid yaml (go templates, jinja templates)
88
+ if "text" not in at:
89
+ alert_state = "FIRING" if "FIRING" in mg.group(2) else mg.group(2)
90
+ alerts[alert_name].append(
91
+ Alert(
92
+ state=alert_state,
93
+ message="placeholder",
94
+ timestamp=timestamp,
95
+ username=m["username"],
96
+ )
97
+ )
98
+ continue
99
+
85
100
  alert_state = ""
86
101
  for line in at["text"].split("\n"):
87
102
  if "Alerts Firing" in line:
@@ -28,16 +28,21 @@ def test_group_alerts():
28
28
  assert csopc
29
29
  assert len(csopc) == 1
30
30
 
31
+ art = alerts["AlertmanagerReceiverTest"]
32
+ assert art
33
+ assert len(art) == 2
34
+
31
35
  # This means one of the list elements has been ignored as it didn't have alertname
32
- # as the total alerts we have from the above tests is 11 and the total of messages
33
- # from the fixture is 12.
36
+ # as the total alerts we have from the above tests is 13 and the total of messages
37
+ # from the fixture is 14.
34
38
  assert set(alerts.keys()) == {
35
39
  "PrometheusTargetFlapping",
36
40
  "SLOMetricAbsent",
37
41
  "PatchmanAlertEvalDelay",
38
42
  "ContainerSecurityOperatorPodCount",
43
+ "AlertmanagerReceiverTest",
39
44
  }
40
- assert len(messages) == 12
45
+ assert len(messages) == 14
41
46
 
42
47
 
43
48
  def test_alert_stats():
@@ -62,3 +67,8 @@ def test_alert_stats():
62
67
  assert csopc.triggered_alerts == 0
63
68
  assert csopc.resolved_alerts == 1
64
69
  assert not csopc.elapsed_times
70
+
71
+ art = alert_stats["AlertmanagerReceiverTest"]
72
+ assert art.triggered_alerts == 1
73
+ assert art.resolved_alerts == 1
74
+ assert median(art.elapsed_times) == 300