Rename ErrRuntimeVersion to NewErrServiceVersion

pull/11632/head
Ilya Zuyev 2021-06-21 19:04:46 -07:00
parent 68749e13b7
commit a6a0791222
2 changed files with 9 additions and 9 deletions

View File

@ -163,8 +163,8 @@ type ListImagesOptions struct {
// ErrContainerRuntimeNotRunning is thrown when container runtime is not running // ErrContainerRuntimeNotRunning is thrown when container runtime is not running
var ErrContainerRuntimeNotRunning = errors.New("container runtime is not running") var ErrContainerRuntimeNotRunning = errors.New("container runtime is not running")
// ErrRuntimeVersion is the error returned when disk image has incompatible version of service // ErrServiceVersion is the error returned when disk image has incompatible version of service
type ErrRuntimeVersion struct { type ErrServiceVersion struct {
// Service is the name of the incompatible service // Service is the name of the incompatible service
Service string Service string
// Installed is the installed version of Service // Installed is the installed version of Service
@ -173,16 +173,16 @@ type ErrRuntimeVersion struct {
Required string Required string
} }
// NewErrRuntimeVersion creates a new ErrRuntimeVersion // NewErrServiceVersion creates a new ErrServiceVersion
func NewErrRuntimeVersion(svc, required, installed string) *ErrRuntimeVersion { func NewErrServiceVersion(svc, required, installed string) *ErrServiceVersion {
return &ErrRuntimeVersion{ return &ErrServiceVersion{
Service: svc, Service: svc,
Installed: installed, Installed: installed,
Required: required, Required: required,
} }
} }
func (e ErrRuntimeVersion) Error() string { func (e ErrServiceVersion) Error() string {
return fmt.Sprintf("service %q version is %v. Required: %v", return fmt.Sprintf("service %q version is %v. Required: %v",
e.Service, e.Installed, e.Required) e.Service, e.Installed, e.Required)
} }
@ -278,14 +278,14 @@ func compatibleWithVersion(runtime, v string) error {
} }
if runtime == "containerd" { if runtime == "containerd" {
if requiredContainerdVersion.GT(vv) { if requiredContainerdVersion.GT(vv) {
return NewErrRuntimeVersion(runtime, requiredContainerdVersion.String(), vv.String()) return NewErrServiceVersion(runtime, requiredContainerdVersion.String(), vv.String())
} }
} }
return nil return nil
} }
// CheckCompatibility checks if the container runtime managed by "cr" is compatible with current minikube code // CheckCompatibility checks if the container runtime managed by "cr" is compatible with current minikube code
// returns: NewErrRuntimeVersion if not // returns: NewErrServiceVersion if not
func CheckCompatibility(cr Manager) error { func CheckCompatibility(cr Manager) error {
v, err := cr.Version() v, err := cr.Version()
if err != nil { if err != nil {

View File

@ -65,7 +65,7 @@ func ExitIfFatal(err error) {
}, "The kubeadm binary within the Docker container is not executable") }, "The kubeadm binary within the Docker container is not executable")
} }
if rtErr, ok := err.(*cruntime.ErrRuntimeVersion); ok { if rtErr, ok := err.(*cruntime.ErrServiceVersion); ok {
exit.Message(reason.Kind{ exit.Message(reason.Kind{
ID: "PROVIDER_INVALID_VERSION", ID: "PROVIDER_INVALID_VERSION",
ExitCode: reason.ExGuestConfig, ExitCode: reason.ExGuestConfig,