MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / bucket

Method bucket

compliance_report.py:135–157  ·  view source on GitHub ↗
(entry: Dict[str, str], rec_host: str, kind: str)

Source from the content-addressed store, hash-verified

133 controls: Dict[str, Dict[str, Any]] = {}
134
135 def bucket(entry: Dict[str, str], rec_host: str, kind: str):
136 code = (entry.get("code") or "").strip()
137 mapping = self._map_lynis_code(code)
138 for control in mapping["controls"]:
139 slot = controls.setdefault(control, {
140 "control": control,
141 "title": mapping["title"],
142 "warnings": 0,
143 "suggestions": 0,
144 "findings": [],
145 })
146 if kind == "warning":
147 slot["warnings"] += 1
148 else:
149 slot["suggestions"] += 1
150 slot["findings"].append({
151 "host": rec_host,
152 "code": code or "—",
153 "kind": kind,
154 "message": entry.get("message", ""),
155 "remediation": entry.get("remediation", ""),
156 "severity": "high" if kind == "warning" else "medium",
157 })
158
159 for rec in lynis:
160 for warning in rec["warnings"]:

Callers

nothing calls this directly

Calls 3

_map_lynis_codeMethod · 0.95
appendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected