Merge pull request #113094 from chendave/fix_errmsg

kubeadm: fix the err msg if the token format is not match
This commit is contained in:
Kubernetes Prow Robot 2022-10-17 02:05:08 -07:00 committed by GitHub
commit cb16d50068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,7 +190,7 @@ func newCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
`), `),
RunE: func(tokenCmd *cobra.Command, args []string) error { RunE: func(tokenCmd *cobra.Command, args []string) error {
if len(args) < 1 { if len(args) < 1 {
return errors.Errorf("missing subcommand; 'token delete' is missing token of form %q", bootstrapapi.BootstrapTokenIDPattern) return errors.Errorf("missing argument; 'token delete' is missing token of form %q or %q", bootstrapapi.BootstrapTokenPattern, bootstrapapi.BootstrapTokenIDPattern)
} }
kubeConfigFile = cmdutil.GetKubeConfigPath(kubeConfigFile) kubeConfigFile = cmdutil.GetKubeConfigPath(kubeConfigFile)
client, err := cmdutil.GetClientSet(kubeConfigFile, dryRun) client, err := cmdutil.GetClientSet(kubeConfigFile, dryRun)
@ -416,7 +416,7 @@ func RunDeleteTokens(out io.Writer, client clientset.Interface, tokenIDsOrTokens
bts, err := bootstraptokenv1.NewBootstrapTokenString(tokenIDOrToken) bts, err := bootstraptokenv1.NewBootstrapTokenString(tokenIDOrToken)
if err != nil { if err != nil {
return errors.Errorf("given token didn't match pattern %q or %q", return errors.Errorf("given token didn't match pattern %q or %q",
bootstrapapi.BootstrapTokenIDPattern, bootstrapapi.BootstrapTokenIDPattern) bootstrapapi.BootstrapTokenPattern, bootstrapapi.BootstrapTokenIDPattern)
} }
tokenID = bts.ID tokenID = bts.ID
} }