qontract-reconcile 0.10.1rc793__py3-none-any.whl → 0.10.1rc795__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.1rc793
3
+ Version: 0.10.1rc795
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
@@ -46,7 +46,6 @@ Requires-Dist: kubernetes ~=24.0
46
46
  Requires-Dist: websocket-client <0.55.0,>=0.35
47
47
  Requires-Dist: sshtunnel >=0.4.0
48
48
  Requires-Dist: croniter <1.1.0,>=1.0.15
49
- Requires-Dist: transity-statuspageio <0.1,>=0.0.3
50
49
  Requires-Dist: pydantic ~=1.10.6
51
50
  Requires-Dist: MarkupSafe ==2.1.1
52
51
  Requires-Dist: filetype ~=1.2.0
@@ -431,7 +431,7 @@ reconcile/skupper_network/models.py,sha256=DNTI7HZv-rqY42GIIxyRuvroHLvdH6rJerjIq
431
431
  reconcile/skupper_network/reconciler.py,sha256=XS-1oKBr_1l3dYUAVqUH6gCHg1G5ZuOfY_7fgGVAiFA,9996
432
432
  reconcile/skupper_network/site_controller.py,sha256=A3K-62BjJ5HiFVydV0ouGoD1NwrO7XhAH15BHAcS9fk,1550
433
433
  reconcile/statuspage/__init__.py,sha256=o9vR6sp3ARDQFZrbCEShelTxjF1XgfLaElK_QVt_248,261
434
- reconcile/statuspage/atlassian.py,sha256=IxtGHd4GXYlJ2Qt3k-MfylM-SIYS7DYaCpjtQvPAmbY,13758
434
+ reconcile/statuspage/atlassian.py,sha256=1W9wQyO0B0qcw5Zrke8h7Rv9xhpXLyMezM7N-5XE8Dg,13665
435
435
  reconcile/statuspage/integration.py,sha256=---tzyl381RddAkIhXb7n3ySjUhuX7FBBI152SYsRfk,3654
436
436
  reconcile/statuspage/page.py,sha256=cJH2sDA8jiAmSdaDitQqNjkyDq_UP2w3s7eauCi-yt4,3740
437
437
  reconcile/statuspage/state.py,sha256=HD9EOoKm_nEqCMLIwW809En3cq5VhyzKJPUbsh-bae8,1617
@@ -770,7 +770,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
770
770
  tools/app_interface_reporter.py,sha256=upA-J-n-HXHKVDINRuMR7vTt-iJvQORKUVi9D3leQto,17738
771
771
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
772
772
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
773
- tools/qontract_cli.py,sha256=ilm3Ezw86rgFKLBgL-FV0xSRLHaFHfG0CKmYZfDe1VU,116022
773
+ tools/qontract_cli.py,sha256=shVGUSDTqa8KO1H6P6YD4fpygQSzZuGxB-5MdhTtzUs,113982
774
774
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
775
775
  tools/template_validation.py,sha256=-U-lTGeLaci8yWPEblCJeev2DOlY1jM9QOOh-O1zts8,3376
776
776
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -788,8 +788,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
788
788
  tools/test/test_qontract_cli.py,sha256=w2l4BHB09k1d-BGJ1jBUNCqDv7zkqYrMHojQXg-21kQ,4155
789
789
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
790
790
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
791
- qontract_reconcile-0.10.1rc793.dist-info/METADATA,sha256=pa6ro62kS2lKnya9PY8ITjbQy-s8wAgrS-N65BECpL0,2364
792
- qontract_reconcile-0.10.1rc793.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
793
- qontract_reconcile-0.10.1rc793.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
794
- qontract_reconcile-0.10.1rc793.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
795
- qontract_reconcile-0.10.1rc793.dist-info/RECORD,,
791
+ qontract_reconcile-0.10.1rc795.dist-info/METADATA,sha256=Ovpk0jb54wUWpHAZyy7CYWlvtanybjVhy_aS0MtypCM,2314
792
+ qontract_reconcile-0.10.1rc795.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
793
+ qontract_reconcile-0.10.1rc795.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
794
+ qontract_reconcile-0.10.1rc795.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
795
+ qontract_reconcile-0.10.1rc795.dist-info/RECORD,,
@@ -7,7 +7,6 @@ from typing import (
7
7
  )
8
8
 
9
9
  import requests
10
- import statuspageio # type: ignore
11
10
  from pydantic import BaseModel
12
11
  from requests import Response
13
12
  from sretoolbox.utils import retry
@@ -49,14 +48,9 @@ class AtlassianAPI(Protocol):
49
48
  def delete_component(self, id: str) -> None: ...
50
49
 
51
50
 
52
- class LegacyLibAtlassianAPI:
51
+ class AtlassianRESTAPI:
53
52
  """
54
- This API class wraps the statuspageio python library for basic component operations.
55
- This class is named Legacy for a couple reasons:
56
- * the underlying library is not maintained anymore
57
- * the library has no type annotated
58
- * the library does not support pagination which becomes important for this API
59
- Therefore this lib will be replaced by a think wrapper based on uplink in an upcoming PR.
53
+ This API class wraps the statuspageio REST API for basic component operations.
60
54
  """
61
55
 
62
56
  def __init__(self, page_id: str, api_url: str, token: str):
@@ -64,9 +58,6 @@ class LegacyLibAtlassianAPI:
64
58
  self.api_url = api_url
65
59
  self.token = token
66
60
  self.auth_headers = {"Authorization": f"OAuth {self.token}"}
67
- self._client = statuspageio.Client(
68
- api_key=self.token, page_id=self.page_id, organization_id="unset"
69
- )
70
61
 
71
62
  @retry(max_attempts=10)
72
63
  def _do_get(self, url: str, params: dict[str, Any]) -> Response:
@@ -96,14 +87,22 @@ class LegacyLibAtlassianAPI:
96
87
  return all_components
97
88
 
98
89
  def update_component(self, id: str, data: dict[str, Any]) -> None:
99
- self._client.components.update(id, **data)
90
+ url = f"{self.api_url}/v1/pages/{self.page_id}/components/{id}"
91
+ requests.patch(
92
+ url, json={"component": data}, headers=self.auth_headers
93
+ ).raise_for_status()
100
94
 
101
95
  def create_component(self, data: dict[str, Any]) -> str:
102
- result = self._client.components.create(**data)
103
- return result["id"]
96
+ url = f"{self.api_url}/v1/pages/{self.page_id}/components"
97
+ response = requests.post(
98
+ url, json={"component": data}, headers=self.auth_headers
99
+ )
100
+ response.raise_for_status()
101
+ return response.json()["id"]
104
102
 
105
103
  def delete_component(self, id: str) -> None:
106
- self._client.components.delete(id)
104
+ url = f"{self.api_url}/v1/pages/{self.page_id}/components/{id}"
105
+ requests.delete(url, headers=self.auth_headers).raise_for_status()
107
106
 
108
107
 
109
108
  class AtlassianStatusPageProvider(StatusPageProvider):
@@ -364,7 +363,7 @@ def init_provider_for_page(
364
363
  """
365
364
  return AtlassianStatusPageProvider(
366
365
  page_name=page.name,
367
- api=LegacyLibAtlassianAPI(
366
+ api=AtlassianRESTAPI(
368
367
  page_id=page.page_id,
369
368
  api_url=page.api_url,
370
369
  token=token,
tools/qontract_cli.py CHANGED
@@ -32,7 +32,6 @@ from rich.console import (
32
32
  )
33
33
  from rich.table import Table
34
34
  from rich.tree import Tree
35
- from sretoolbox.utils import threaded
36
35
 
37
36
  import reconcile.aus.base as aus
38
37
  import reconcile.openshift_base as ob
@@ -1197,69 +1196,6 @@ def clusters_aws_account_ids(ctx):
1197
1196
  print_output(ctx.obj["options"], results, columns)
1198
1197
 
1199
1198
 
1200
- @get.command()
1201
- @click.pass_context
1202
- def terraform_users_credentials(ctx) -> None:
1203
- credentials = []
1204
- state = init_state(integration="account-notifier")
1205
-
1206
- skip_accounts, appsre_pgp_key, _ = tfu.get_reencrypt_settings()
1207
-
1208
- if skip_accounts:
1209
- accounts, working_dirs, _, aws_api = tfu.setup(
1210
- False,
1211
- 1,
1212
- skip_accounts,
1213
- account_name=None,
1214
- appsre_pgp_key=appsre_pgp_key,
1215
- )
1216
-
1217
- tf = Terraform(
1218
- tfu.QONTRACT_INTEGRATION,
1219
- tfu.QONTRACT_INTEGRATION_VERSION,
1220
- tfu.QONTRACT_TF_PREFIX,
1221
- accounts,
1222
- working_dirs,
1223
- 10,
1224
- aws_api,
1225
- init_users=True,
1226
- )
1227
- for account, output in tf.outputs.items():
1228
- if account in skip_accounts:
1229
- user_passwords = tf.format_output(output, tf.OUTPUT_TYPE_PASSWORDS)
1230
- console_urls = tf.format_output(output, tf.OUTPUT_TYPE_CONSOLEURLS)
1231
- for user_name, enc_password in user_passwords.items():
1232
- item = {
1233
- "account": account,
1234
- "console_url": console_urls[account],
1235
- "user_name": user_name,
1236
- "encrypted_password": enc_password,
1237
- }
1238
- credentials.append(item)
1239
-
1240
- secrets = state.ls()
1241
-
1242
- def _get_secret(secret_key: str):
1243
- if secret_key.startswith("/output/"):
1244
- secret_data = state.get(secret_key[1:])
1245
- if secret_data["account"] not in skip_accounts:
1246
- return secret_data
1247
- return None
1248
-
1249
- secret_result = threaded.run(
1250
- _get_secret,
1251
- secrets,
1252
- 10,
1253
- )
1254
-
1255
- for secret in secret_result:
1256
- if secret and secret["account"] not in skip_accounts:
1257
- credentials.append(secret)
1258
-
1259
- columns = ["account", "console_url", "user_name", "encrypted_password"]
1260
- print_output(ctx.obj["options"], credentials, columns)
1261
-
1262
-
1263
1199
  @root.command()
1264
1200
  @click.argument("account_name")
1265
1201
  @click.pass_context