Unverified Commit 97143e51 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #51401 from CaoShuFeng/rename_context

Automatic merge from submit-queue (batch tested with PRs 51401, 54056, 54977, 55017, 55052). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. [cli] exit when Validate() returns an error cmdutil.UsageErrorf() does nothing but returna a string. When Validate() returns an error, we should call exit() function. fix: https://github.com/kubernetes/kubectl/issues/119 **Release note**: ``` NONE ```
parents 92952cfe 26032ad6
......@@ -43,7 +43,7 @@ const (
var (
renameContextLong = templates.LongDesc(`
Renames a context from the kubeconfig file .
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you wish change.
......@@ -70,7 +70,7 @@ func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAcces
cmdutil.CheckErr(err)
}
if err := options.Validate(); err != nil {
cmdutil.UsageErrorf(cmd, err.Error())
cmdutil.CheckErr(cmdutil.UsageErrorf(cmd, err.Error()))
}
if err := options.RunRenameContext(out); err != nil {
cmdutil.CheckErr(err)
......
......@@ -124,7 +124,7 @@ func (o *ConvertOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.C
return err
}
if !scheme.Registry.IsEnabledVersion(o.outputVersion) {
cmdutil.UsageErrorf(cmd, "'%s' is not a registered version.", o.outputVersion)
return cmdutil.UsageErrorf(cmd, "'%s' is not a registered version.", o.outputVersion)
}
// build the builder
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment