| Total Complexity | 2 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 93.75% |
| Changes | 0 | ||
| 1 | # Copyright 2022, Red Hat, Inc. |
||
| 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
||
| 3 | |||
| 4 | 1 | from openscap_report.dataclasses import asdict, dataclass |
|
| 5 | |||
| 6 | 1 | REMEDIATION_JSON_KEYS = [ |
|
| 7 | "remediation_id", |
||
| 8 | "system", |
||
| 9 | "complexity", |
||
| 10 | "disruption", |
||
| 11 | "strategy", |
||
| 12 | "fix", |
||
| 13 | ] |
||
| 14 | |||
| 15 | 1 | HIDDEN_REMEDIATION_TYPES = [ |
|
| 16 | "urn:redhat:anaconda:pre", |
||
| 17 | "urn:xccdf:fix:script:kickstart", |
||
| 18 | ] |
||
| 19 | |||
| 20 | |||
| 21 | 1 | @dataclass |
|
| 22 | 1 | class Remediation: |
|
| 23 | 1 | remediation_id: str |
|
| 24 | 1 | system: str = "" |
|
| 25 | 1 | complexity: str = "" |
|
| 26 | 1 | disruption: str = "" |
|
| 27 | 1 | strategy: str = "" |
|
| 28 | 1 | fix: str = "" |
|
| 29 | |||
| 30 | 1 | def as_dict(self): |
|
| 31 | return asdict(self) |
||
| 32 | |||
| 33 | 1 | def get_type(self): |
|
| 34 | 1 | script_types = { |
|
| 35 | "urn:xccdf:fix:script:sh": "Shell script", |
||
| 36 | "urn:xccdf:fix:script:ansible": "Ansible snippet", |
||
| 37 | "urn:xccdf:fix:script:puppet": "Puppet snippet", |
||
| 38 | "urn:redhat:anaconda:pre": "Anaconda snippet", |
||
| 39 | "urn:xccdf:fix:script:kubernetes": "Kubernetes snippet", |
||
| 40 | "urn:redhat:osbuild:blueprint": "OSBuild Blueprint snippet", |
||
| 41 | "urn:xccdf:fix:script:kickstart": "Kickstart snippet", |
||
| 42 | } |
||
| 43 | return script_types.get(self.system, "script") |
||
| 44 |