qontract-reconcile 0.10.1rc1112__py3-none-any.whl → 0.10.1rc1114__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.1rc1112
3
+ Version: 0.10.1rc1114
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
@@ -677,7 +677,6 @@ reconcile/utils/external_resource_spec.py,sha256=bhH_xneFwATdFumTPkiQmcVKYI0gcaW
677
677
  reconcile/utils/external_resources.py,sha256=GC4wYuSXwk2ifr3aDEwnEiumaYqWhzgKK-hXp6pXemA,7516
678
678
  reconcile/utils/filtering.py,sha256=S4PbMHuFr3ED0P2Q_ea5CAaB7FimI62B-F5YTaKrphA,402
679
679
  reconcile/utils/git.py,sha256=wzVIYAeKlMGW538U1mkJWUI6h_mFRUY4lawh2AR8hw4,2345
680
- reconcile/utils/git_secrets.py,sha256=y1rEhwA8DyDpBSAEuhMS7Y2X3mpxT2zQ4zyDFkhLe_g,1936
681
680
  reconcile/utils/github_api.py,sha256=R8OvqyPdnRqvP-Efnv9RvIcbBlb4M0KC4RlbnJMD0Tg,2426
682
681
  reconcile/utils/gitlab_api.py,sha256=C1nsHQKKybsmFdaG9vsItBjJm69ym4VWbqbKfAEf7oY,29305
683
682
  reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
@@ -703,7 +702,7 @@ reconcile/utils/oc.py,sha256=AjwQnzLxnMv0ML70GfjTHeYmiNsztI8kgXQF3N0Hvfw,66088
703
702
  reconcile/utils/oc_connection_parameters.py,sha256=7DiEGo--TJelfYoZXJFyTBPeTw9kXL3L58vy2fiJnes,9643
704
703
  reconcile/utils/oc_filters.py,sha256=Tz3OwtbUaYKmxENFls5CtPVzkZDeFXknw53dJe-wbT8,1382
705
704
  reconcile/utils/oc_map.py,sha256=U8cYhiaZsomkofzbIjVrl7E7crRxkS2JKsFpVeeHVE8,8964
706
- reconcile/utils/ocm_base_client.py,sha256=t5xwO-atG3e64tiMFLF5Szzcq1KLYf4g7g294YmaeMo,6332
705
+ reconcile/utils/ocm_base_client.py,sha256=ntBCtm-njkGsI_wMpdLk5iLukbKz1zKNyo4rCWlKxFU,6427
707
706
  reconcile/utils/openshift_resource.py,sha256=ZyQ436YdV80nvKGPuzYyYLLJj8Abjnb3e_PsejxBTNM,24715
708
707
  reconcile/utils/openssl.py,sha256=QVvhzhpChq_4Daf_5wE1qeZJr4thg3DDjJPn4bOPD4E,365
709
708
  reconcile/utils/output.py,sha256=xh2Not-Xm97KeRx_J5nc2PP5tDwpDLZBeCrWI0S-al4,2034
@@ -870,8 +869,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
870
869
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
871
870
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
872
871
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
873
- qontract_reconcile-0.10.1rc1112.dist-info/METADATA,sha256=jkBPZb4lP4Bc1Mkkf2qwJBozeU5pM6FhMy6qy3vCsz8,2213
874
- qontract_reconcile-0.10.1rc1112.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
875
- qontract_reconcile-0.10.1rc1112.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
876
- qontract_reconcile-0.10.1rc1112.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
877
- qontract_reconcile-0.10.1rc1112.dist-info/RECORD,,
872
+ qontract_reconcile-0.10.1rc1114.dist-info/METADATA,sha256=vn63-28mfgbBR3tbkdYLhiq552vpOX4DGe0LqDP4rZQ,2213
873
+ qontract_reconcile-0.10.1rc1114.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
874
+ qontract_reconcile-0.10.1rc1114.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
875
+ qontract_reconcile-0.10.1rc1114.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
876
+ qontract_reconcile-0.10.1rc1114.dist-info/RECORD,,
@@ -142,7 +142,11 @@ class OCMBaseClient:
142
142
  def delete(self, api_path: str):
143
143
  ocm_request.labels(verb="DELETE", client_id=self._access_token_client_id).inc()
144
144
  r = self._session.delete(f"{self._url}{api_path}", timeout=REQUEST_TIMEOUT_SEC)
145
- r.raise_for_status()
145
+ try:
146
+ r.raise_for_status()
147
+ except Exception:
148
+ logging.error(r.text)
149
+ raise
146
150
 
147
151
  def close(self) -> None:
148
152
  self._session.close()
@@ -1,63 +0,0 @@
1
- import logging
2
- import os
3
- import subprocess
4
- import tempfile
5
-
6
- import requests
7
- from sretoolbox.utils import retry
8
-
9
- from reconcile.utils import git
10
-
11
-
12
- @retry()
13
- def scan_history(repo_url, existing_keys):
14
- logging.info(f"scanning {repo_url}")
15
- if requests.get(repo_url, timeout=60).status_code == 404:
16
- logging.info(f"not found {repo_url}")
17
- return []
18
-
19
- with tempfile.TemporaryDirectory() as wd:
20
- git.clone(repo_url, wd)
21
- subprocess.run(["git", "secrets", "--install"], check=False, cwd=wd)
22
- result = subprocess.run(
23
- ["git", "secrets", "--scan-history"],
24
- capture_output=True,
25
- check=False,
26
- cwd=wd,
27
- )
28
- if result.returncode == 0:
29
- return []
30
- logging.info(f"found suspects in {repo_url}")
31
- suspected_files = get_suspected_files(result.stderr.decode("utf-8"))
32
- leaked_keys = get_leaked_keys(wd, suspected_files, existing_keys)
33
- if leaked_keys:
34
- logging.info(f"found suspected leaked keys: {leaked_keys}")
35
- return leaked_keys
36
-
37
-
38
- def get_suspected_files(error):
39
- suspects = []
40
- for e in error.split("\n"):
41
- if not e:
42
- break
43
- if e.startswith("warning"):
44
- continue
45
- commit_path_split = e.split(" ")[0].split(":")
46
- commit, path = commit_path_split[0], commit_path_split[1]
47
-
48
- suspects.append((commit, path))
49
- return set(suspects)
50
-
51
-
52
- def get_leaked_keys(repo_wd, suspected_files, existing_keys):
53
- all_leaked_keys = []
54
- for s in suspected_files:
55
- commit, file_relative_path = s[0], s[1]
56
- git.checkout(commit, repo_wd)
57
- file_path = os.path.join(repo_wd, file_relative_path)
58
- with open(file_path, encoding="locale") as f:
59
- content = f.read()
60
- leaked_keys = [key for key in existing_keys if key in content]
61
- all_leaked_keys.extend(leaked_keys)
62
-
63
- return all_leaked_keys