Skip to content

Commit

Permalink
Resolve review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Oct 8, 2024
1 parent 3829fff commit 3f427f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions src/actions/csi_benchmark.py → src/actions/cis_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@
GO_PKG = "github.com/aquasecurity/kube-bench"
RESULTS_DIR = "/home/ubuntu/kube-bench-results"

# Remediation dicts associate a failing test with a Remedy to fix it.
# Conservative fixes will probably leave the cluster in a good state.
# Dangerous fixes will likely break the cluster.
# Tuple examples:
# {'1.2.3': Remedy('manual -- we don't know how to auto fix this', None, None)}
# {'1.2.3': Remedy('cli', 'command to run', None)}
# {'1.2.3': Remedy('kv', 'snap', {cfg_key: value})}


@dataclasses.dataclass
class Remedy:
"""Remedy class for benchmarking."""
"""Remedy class for benchmarking.
Remediation dicts associate a failing test with a Remedy to fix it.
Conservative fixes will probably leave the cluster in a good state.
Dangerous fixes will likely break the cluster.
Tuple examples:
```
{'1.2.3': Remedy('manual -- we don't know how to auto fix this', None, None)}
{'1.2.3': Remedy('cli', 'command to run', None)}
{'1.2.3': Remedy('kv', 'snap', {cfg_key: value})}
```
"""

type: str
command: Optional[str]
Expand Down Expand Up @@ -132,7 +135,7 @@ def _move_matching_parent(dirpath, filename, dest):
raise ActionError(f"Could not find {filename} in {dirpath}")


class CSIBenchmark(ops.Object):
class CISBenchmark(ops.Object):
"""Action class for CIS benchmarking."""

stored = ops.StoredState()
Expand Down
4 changes: 2 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from ops.interface_kube_control import KubeControlProvides
from ops.interface_tls_certificates import CertificatesRequires

import actions.csi_benchmark
import actions.cis_benchmark
import actions.general
import actions.namespace
import actions.restart
Expand Down Expand Up @@ -132,7 +132,7 @@ def __init__(self, *args):
self.external_cloud_provider = ExternalCloudProvider(self, "external-cloud-provider")
self.tokens = TokensProvider(self, endpoint="tokens")
self.encryption_at_rest = EncryptionAtRest(self)
self.cis_benchmark = actions.csi_benchmark.CSIBenchmark(self)
self.cis_benchmark = actions.cis_benchmark.CISBenchmark(self)

# register charm actions
action_events = [
Expand Down

0 comments on commit 3f427f3

Please sign in to comment.