Skip to content

Commit c7e5ece

Browse files
Merge branch 'main' into fix/cinder-backup-check-reliability
2 parents a460c40 + e28ed22 commit c7e5ece

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

compliance-monitor/monitor.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,16 @@ def evaluate(self, scope_results):
281281
by_validity[self.versions[vname].validity].append(vname)
282282
# go through worsening validity values until a passing version is found
283283
relevant = []
284+
best_passed = None
284285
for validity in ('effective', 'warn', 'deprecated'):
285286
vnames = by_validity[validity]
286287
relevant.extend(vnames)
287288
if any(version_results[vname]['result'] == 1 for vname in vnames):
289+
best_passed = validity
288290
break
289291
# always include draft (but only at the end)
290292
relevant.extend(by_validity['draft'])
291293
passed = [vname for vname in relevant if version_results[vname]['result'] == 1]
292-
if passed:
293-
summary = 1 if self.versions[passed[0]].validity in ('effective', 'warn') else -1
294-
else:
295-
summary = 0
296294
return {
297295
'name': self.name,
298296
'versions': version_results,
@@ -302,7 +300,7 @@ def evaluate(self, scope_results):
302300
vname + ASTERISK_LOOKUP[self.versions[vname].validity]
303301
for vname in passed
304302
]),
305-
'summary': summary,
303+
'best_passed': best_passed,
306304
}
307305

308306
def update_lookup(self, target_dict):
@@ -727,8 +725,13 @@ def pick_filter(results, subject, scope):
727725
def summary_filter(scope_results):
728726
"""Jinja filter to construct summary from `scope_results`"""
729727
passed_str = scope_results.get('passed_str', '') or '–'
730-
summary = scope_results.get('summary', 0)
731-
color = {1: '✅'}.get(summary, '🛑') # instead of 🟢🔴 (hard to distinguish for color-blind folks)
728+
best_passed = scope_results.get('best_passed')
729+
# avoid simple 🟢🔴 (hard to distinguish for color-blind folks)
730+
color = {
731+
'effective': '✅',
732+
'warn': '✅', # forgo differentiation here in favor of simplicity (will be apparent in version list)
733+
'deprecated': '🟧',
734+
}.get(best_passed, '🛑')
732735
return f'{color} {passed_str}'
733736

734737

compliance-monitor/templates/overview.md.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
we could of course iterate over results etc., but hardcode the table (except the actual results, of course)
33
for the time being to have the highest degree of control
44
-#}
5+
6+
Version numbers are suffixed by a symbol depending on state: * for _draft_, † for _warn_ (soon to be deprecated), and †† for _deprecated_.
7+
58
{% set iaas = '50393e6f-2ae1-4c5c-a62c-3b75f2abef3f' -%}
69
| Name | Description | Operator | [SCS-compatible IaaS](https://docs.scs.community/standards/scs-compatible-iaas/) | HealthMon |
710
|-------|--------------|-----------|----------------------|:----------:|

0 commit comments

Comments
 (0)