提交 b6506007 编写于 作者: K Kenta Iso

refactor: remove warning log to avoid duplicate logging and remove useless getter func

上级 39f71346
...@@ -24,8 +24,9 @@ import ( ...@@ -24,8 +24,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/pkg/errors"
"github.com/docker/machine/libmachine/drivers" "github.com/docker/machine/libmachine/drivers"
"github.com/golang/glog"
"github.com/pborman/uuid" "github.com/pborman/uuid"
"k8s.io/minikube/pkg/drivers/hyperkit" "k8s.io/minikube/pkg/drivers/hyperkit"
...@@ -94,14 +95,14 @@ func status() registry.State { ...@@ -94,14 +95,14 @@ func status() registry.State {
// Split version from v0.YYYYMMDD-HH-xxxxxxx or 0.YYYYMMDD to YYYYMMDD // Split version from v0.YYYYMMDD-HH-xxxxxxx or 0.YYYYMMDD to YYYYMMDD
currentVersion := convertVersionToDate(string(out)) currentVersion := convertVersionToDate(string(out))
specificVersion := splitHyperKitVersion(getHyperKitVersion()) specificVersion := splitHyperKitVersion(minimumVersion)
// If current hyperkit is not newer than minimumVersion, suggest upgrade information // If current hyperkit is not newer than minimumVersion, suggest upgrade information
isNew, err := isNewerVersion(currentVersion, specificVersion) isNew, err := isNewerVersion(currentVersion, specificVersion)
if err != nil { if err != nil {
return registry.State{Installed: true, Healthy: true, Error: fmt.Errorf("hyperkit version check failed:\n%s", err), Doc: docURL} return registry.State{Installed: true, Healthy: true, Error: fmt.Errorf("hyperkit version check failed:\n%v", err), Doc: docURL}
} }
if !isNew { if !isNew {
return registry.State{Installed: true, Healthy: true, Error: fmt.Errorf("the installed hyperkit version (0.%s) is older than the minimum recommended version (%s)", currentVersion, getHyperKitVersion()), Fix: "Run 'brew upgrade hyperkit'", Doc: docURL} return registry.State{Installed: true, Healthy: true, Error: fmt.Errorf("the installed hyperkit version (0.%s) is older than the minimum recommended version (%s)", currentVersion, minimumVersion), Fix: "Run 'brew upgrade hyperkit'", Doc: docURL}
} }
return registry.State{Installed: true, Healthy: true} return registry.State{Installed: true, Healthy: true}
...@@ -113,13 +114,11 @@ func isNewerVersion(currentVersion string, specificVersion string) (bool, error) ...@@ -113,13 +114,11 @@ func isNewerVersion(currentVersion string, specificVersion string) (bool, error)
layout := "20060102" layout := "20060102"
currentVersionDate, err := time.Parse(layout, currentVersion) currentVersionDate, err := time.Parse(layout, currentVersion)
if err != nil { if err != nil {
glog.Warningf("Unable to parse to time.Date: %v", err) return false, errors.Wrap(err, "parse date")
return false, err
} }
specificVersionDate, err := time.Parse(layout, specificVersion) specificVersionDate, err := time.Parse(layout, specificVersion)
if err != nil { if err != nil {
glog.Warningf("Unable to parse to time.Date: %v", err) return false, errors.Wrap(err, "parse date")
return false, err
} }
// If currentVersionDate is equal to specificVersionDate, no need to upgrade hyperkit // If currentVersionDate is equal to specificVersionDate, no need to upgrade hyperkit
if currentVersionDate.Equal(specificVersionDate) { if currentVersionDate.Equal(specificVersionDate) {
...@@ -154,8 +153,3 @@ func splitHyperKitVersion(version string) string { ...@@ -154,8 +153,3 @@ func splitHyperKitVersion(version string) string {
} }
return version return version
} }
// getHyperKitVersion returns the minimum hyperKit version
func getHyperKitVersion() string {
return minimumVersion
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册