mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2025-06-05 15:48:51 +00:00
Restore warning messages and dont quit on verification error.
This commit is contained in:
parent
e6479afd01
commit
2119d119b0
@ -55,14 +55,11 @@ func runChecks(t check.NodeType) {
|
|||||||
var summary check.Summary
|
var summary check.Summary
|
||||||
var file string
|
var file string
|
||||||
|
|
||||||
fails := verifyNodeType(t)
|
warns := verifyNodeType(t)
|
||||||
if len(fails) > 0 {
|
if len(warns) > 0 {
|
||||||
fmt.Fprintf(os.Stderr, "%s could not start: please resolve these issues\n", os.Args[0])
|
for _, w := range warns {
|
||||||
for _, w := range fails {
|
colorPrint(check.WARN, w)
|
||||||
colorPrint(check.FAIL, w)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch t {
|
switch t {
|
||||||
@ -117,7 +114,7 @@ func runChecks(t check.NodeType) {
|
|||||||
|
|
||||||
fmt.Println(string(out))
|
fmt.Println(string(out))
|
||||||
} else {
|
} else {
|
||||||
prettyPrint(fails, controls, summary)
|
prettyPrint(warns, controls, summary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,10 +243,7 @@ func verifyBin(binPath []string) []string {
|
|||||||
|
|
||||||
// Run ps command
|
// Run ps command
|
||||||
cmd := exec.Command("ps", "-C", binList, "-o", "cmd", "--no-headers")
|
cmd := exec.Command("ps", "-C", binList, "-o", "cmd", "--no-headers")
|
||||||
out, err := cmd.Output()
|
out, _ := cmd.Output()
|
||||||
if err != nil {
|
|
||||||
w = append(w, fmt.Sprintf("%v could not get process information\n", binPath))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actual verification
|
// Actual verification
|
||||||
for _, b := range binPath {
|
for _, b := range binPath {
|
||||||
@ -277,10 +271,7 @@ func verifyKubeVersion(binPath []string) []string {
|
|||||||
|
|
||||||
// Check version
|
// Check version
|
||||||
cmd := exec.Command(b, "--version")
|
cmd := exec.Command(b, "--version")
|
||||||
out, err := cmd.Output()
|
out, _ := cmd.Output()
|
||||||
if err != nil {
|
|
||||||
w = append(w, fmt.Sprintf("failed executing %s --version: %v\n", b, err))
|
|
||||||
}
|
|
||||||
|
|
||||||
matched := strings.Contains(string(out), kubeVersion)
|
matched := strings.Contains(string(out), kubeVersion)
|
||||||
if !matched {
|
if !matched {
|
||||||
|
Loading…
Reference in New Issue
Block a user