mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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 ```
This commit is contained in:
commit
97143e51f9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user