qontract-reconcile 0.10.2.dev218__py3-none-any.whl → 0.10.2.dev220__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.
- {qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/RECORD +6 -6
- reconcile/utils/helpers.py +4 -2
- reconcile/utils/output.py +32 -18
- {qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.2.
|
3
|
+
Version: 0.10.2.dev220
|
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
|
{qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/RECORD
RENAMED
@@ -629,7 +629,7 @@ reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
|
|
629
629
|
reconcile/utils/gql.py,sha256=C0thIm_k9MBldfqwHzyqtYZk9sIvMdm9IbbnXLGwjD8,14158
|
630
630
|
reconcile/utils/grouping.py,sha256=vr9SFHZ7bqmHYrvYcEZt-Er3-yQYfAAdq5sHLZVmXPY,456
|
631
631
|
reconcile/utils/helm.py,sha256=wC1h0GylhDFeZ6hZEtYy2giAGIIQroaQhkAtURoSlI8,3893
|
632
|
-
reconcile/utils/helpers.py,sha256=
|
632
|
+
reconcile/utils/helpers.py,sha256=koyAtYnxsUVx-HIn6GpedcUE-ekz_VtoYDkiZ0iv8ik,1795
|
633
633
|
reconcile/utils/imap_client.py,sha256=h8YDiCSCvroErhpH_-KGYI7Y2WU2Q2oSpuxDFbOkSbY,1989
|
634
634
|
reconcile/utils/instrumented_wrappers.py,sha256=VqT4s0Bdicv224-uSeSaugtHXm-xJ3oSeBiqj0QQRiU,1942
|
635
635
|
reconcile/utils/jenkins_api.py,sha256=RaKuZmO7_lbI-hE6c_Pq2a6CQdmBVj7BcP2jR68cIbI,7081
|
@@ -651,7 +651,7 @@ reconcile/utils/oc_map.py,sha256=ougQ-Wlsa8ymoE_lPQ7g2LlpsUOsHVeRCLYW_6fjeWU,897
|
|
651
651
|
reconcile/utils/ocm_base_client.py,sha256=t5kxhklEqOpenXPkXiwQIk8d3D7hIUndBm5qGusS0bc,6681
|
652
652
|
reconcile/utils/openshift_resource.py,sha256=DI-e04f4NqEUFJ_9HzjY-QMhFt7o2XVauM09mzMC5Vs,24716
|
653
653
|
reconcile/utils/openssl.py,sha256=QVvhzhpChq_4Daf_5wE1qeZJr4thg3DDjJPn4bOPD4E,365
|
654
|
-
reconcile/utils/output.py,sha256=
|
654
|
+
reconcile/utils/output.py,sha256=wvsyf8NsFTaFHNkc8to75ta8f474Y4TMO4cHyAHEePk,2209
|
655
655
|
reconcile/utils/pagerduty_api.py,sha256=_24i9S_4X7nlvHb-7clXRE0p1BG4ODjOzKxWO-F9WgI,7627
|
656
656
|
reconcile/utils/parse_dhms_duration.py,sha256=TONpLnec5gHeF7k815YNJpQyDjXhkxZIcv9s8ffbTSY,1840
|
657
657
|
reconcile/utils/password_validator.py,sha256=XwuWg-8CPlcuG7dl_oQ1G1h2gSVSnfMym_VkuprpWVg,2183
|
@@ -815,7 +815,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
815
815
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
816
816
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
817
817
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
818
|
-
qontract_reconcile-0.10.2.
|
819
|
-
qontract_reconcile-0.10.2.
|
820
|
-
qontract_reconcile-0.10.2.
|
821
|
-
qontract_reconcile-0.10.2.
|
818
|
+
qontract_reconcile-0.10.2.dev220.dist-info/METADATA,sha256=rO1unVRKO_KPhHqQOr2hHQ0Ckya1MWmCrjTez_2dcjo,24555
|
819
|
+
qontract_reconcile-0.10.2.dev220.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
820
|
+
qontract_reconcile-0.10.2.dev220.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
821
|
+
qontract_reconcile-0.10.2.dev220.dist-info/RECORD,,
|
reconcile/utils/helpers.py
CHANGED
@@ -4,6 +4,7 @@ import re
|
|
4
4
|
import string
|
5
5
|
from collections import Counter
|
6
6
|
from collections.abc import (
|
7
|
+
Generator,
|
7
8
|
Iterable,
|
8
9
|
Mapping,
|
9
10
|
)
|
@@ -17,11 +18,12 @@ DEFAULT_TOGGLE_LEVEL = logging.ERROR
|
|
17
18
|
|
18
19
|
|
19
20
|
@contextmanager
|
20
|
-
def toggle_logger(log_level: int = DEFAULT_TOGGLE_LEVEL):
|
21
|
+
def toggle_logger(log_level: int = DEFAULT_TOGGLE_LEVEL) -> Generator[logging.Logger]:
|
21
22
|
logger = logging.getLogger()
|
22
23
|
default_level = logger.level
|
23
24
|
try:
|
24
|
-
|
25
|
+
logger.setLevel(log_level)
|
26
|
+
yield logger
|
25
27
|
finally:
|
26
28
|
logger.setLevel(default_level)
|
27
29
|
|
reconcile/utils/output.py
CHANGED
@@ -41,26 +41,40 @@ def print_output(
|
|
41
41
|
return formatted_content
|
42
42
|
|
43
43
|
|
44
|
-
def
|
44
|
+
def _format_cell(cell: dict, column: str, table_format: str) -> dict | str:
|
45
|
+
# example: for column 'cluster.name'
|
46
|
+
# cell = item['cluster']['name']
|
47
|
+
raw_data = cell
|
48
|
+
for token in column.split("."):
|
49
|
+
raw_data = raw_data.get(token) or {}
|
50
|
+
if raw_data == {}:
|
51
|
+
return ""
|
52
|
+
|
53
|
+
if not isinstance(raw_data, list | str):
|
54
|
+
return raw_data
|
55
|
+
|
56
|
+
data = ""
|
57
|
+
if isinstance(raw_data, str):
|
58
|
+
data = raw_data
|
59
|
+
|
60
|
+
if isinstance(raw_data, list):
|
61
|
+
if table_format == "github":
|
62
|
+
data = "<br />".join(raw_data)
|
63
|
+
else:
|
64
|
+
data = "\n".join(raw_data)
|
65
|
+
|
66
|
+
if table_format == "github":
|
67
|
+
return data.replace("|", "|")
|
68
|
+
|
69
|
+
return data
|
70
|
+
|
71
|
+
|
72
|
+
def format_table(
|
73
|
+
content: Iterable[dict], columns: Iterable[str], table_format: str = "simple"
|
74
|
+
) -> str:
|
45
75
|
headers = [column.upper() for column in columns]
|
46
76
|
table_data = []
|
47
77
|
for item in content:
|
48
|
-
row_data = []
|
49
|
-
for column in columns:
|
50
|
-
# example: for column 'cluster.name'
|
51
|
-
# cell = item['cluster']['name']
|
52
|
-
cell = item
|
53
|
-
for token in column.split("."):
|
54
|
-
cell = cell.get(token) or {}
|
55
|
-
if cell == {}:
|
56
|
-
cell = ""
|
57
|
-
if isinstance(cell, list):
|
58
|
-
if table_format == "github":
|
59
|
-
cell = "<br />".join(cell)
|
60
|
-
else:
|
61
|
-
cell = "\n".join(cell)
|
62
|
-
if table_format == "github" and isinstance(cell, str):
|
63
|
-
cell = cell.replace("|", "|")
|
64
|
-
row_data.append(cell)
|
78
|
+
row_data = [_format_cell(item, column, table_format) for column in columns]
|
65
79
|
table_data.append(row_data)
|
66
80
|
return tabulate(table_data, headers=headers, tablefmt=table_format)
|
{qontract_reconcile-0.10.2.dev218.dist-info → qontract_reconcile-0.10.2.dev220.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|