1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2024-12-22 14:48:07 +00:00

Only get runningVersion if --version has not been provided

Signed-off-by: Weston Steimel <weston.steimel@gmail.com>
This commit is contained in:
Weston Steimel 2019-01-24 00:10:27 +00:00
parent 8dabb7dc37
commit 42f4152058
No known key found for this signature in database
GPG Key ID: 61849329106F14D6

View File

@ -44,10 +44,13 @@ func runChecks(nodetype check.NodeType) {
file = federatedFile
}
runningVersion, err := getKubeVersion()
if err != nil && kubeVersion == "" {
runningVersion := ""
if kubeVersion == "" {
runningVersion, err = getKubeVersion()
if err != nil {
exitWithError(fmt.Errorf("Version check failed: %s\nAlternatively, you can specify the version with --version", err))
}
}
path, err := getConfigFilePath(kubeVersion, runningVersion, file)
if err != nil {
exitWithError(fmt.Errorf("can't find %s controls file in %s: %v", nodetype, cfgDir, err))