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

Fix bug causing kubectl version to always return default version.

This commit is contained in:
Abubakr-Sadik Nii Nai Davis 2017-11-14 22:27:55 +00:00
parent 42a1068964
commit c60c459bc4

View File

@ -232,7 +232,7 @@ func getKubeVersion() string {
serverVersionRe := regexp.MustCompile(`Server Version: v(\d+.\d+)`) serverVersionRe := regexp.MustCompile(`Server Version: v(\d+.\d+)`)
subs := serverVersionRe.FindStringSubmatch(string(out)) subs := serverVersionRe.FindStringSubmatch(string(out))
if len(subs) > 2 { if len(subs) == 2 {
ver = string(subs[1]) ver = string(subs[1])
validVersionPttn := `\d.\d` validVersionPttn := `\d.\d`
if matched, _ = regexp.MatchString(validVersionPttn, ver); !matched { if matched, _ = regexp.MatchString(validVersionPttn, ver); !matched {