diff --git a/pkg/cmd/kubeblocks/install.go b/pkg/cmd/kubeblocks/install.go index 5a51d6ca7..070ff331e 100644 --- a/pkg/cmd/kubeblocks/install.go +++ b/pkg/cmd/kubeblocks/install.go @@ -403,9 +403,9 @@ func (o *InstallOptions) checkVersion(v util.Version) error { // check installing version exists if exists, err := versionExists(o.Version); !exists { if err != nil { - klog.V(1).Infof(err.Error()) + return err } - return errors.Wrapf(err, "version %s does not exist, please use \"kbcli kubeblocks list-versions --devel\" to show the available versions", o.Version) + return fmt.Errorf("version %s does not exist, please use \"kbcli kubeblocks list-versions --devel\" to show the available versions", o.Version) } versionErr := fmt.Errorf("failed to get kubernetes version") diff --git a/pkg/cmd/kubeblocks/upgrade.go b/pkg/cmd/kubeblocks/upgrade.go index 2ba059e27..71520b5b9 100644 --- a/pkg/cmd/kubeblocks/upgrade.go +++ b/pkg/cmd/kubeblocks/upgrade.go @@ -122,6 +122,14 @@ func (o *InstallOptions) Upgrade() error { } fmt.Fprintf(o.Out, "Current KubeBlocks version %s.\n", v.KubeBlocks) + // check installing version exists + if exists, err := versionExists(o.Version); !exists { + if err != nil { + return err + } + return fmt.Errorf("version %s does not exist, please use \"kbcli kubeblocks list-versions --devel\" to show the available versions", o.Version) + } + if err = o.checkVersion(v); err != nil { return err }