From 6694b6bf9af6979577dde558461064ab7b7e7fe2 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Mon, 17 Oct 2022 15:49:30 +0800 Subject: [PATCH] kubeadm: fix the err msg if the token format is not match Previously, the err msg will repeat the token ID of the form "[a-z0-9]{6}" if the token doesn't match with the desired format. Signed-off-by: Dave Chen --- cmd/kubeadm/app/cmd/token.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/kubeadm/app/cmd/token.go b/cmd/kubeadm/app/cmd/token.go index b53b2b6ae86..84e0a0c1f90 100644 --- a/cmd/kubeadm/app/cmd/token.go +++ b/cmd/kubeadm/app/cmd/token.go @@ -190,7 +190,7 @@ func newCmdToken(out io.Writer, errW io.Writer) *cobra.Command { `), RunE: func(tokenCmd *cobra.Command, args []string) error { 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) client, err := cmdutil.GetClientSet(kubeConfigFile, dryRun) @@ -416,7 +416,7 @@ func RunDeleteTokens(out io.Writer, client clientset.Interface, tokenIDsOrTokens bts, err := bootstraptokenv1.NewBootstrapTokenString(tokenIDOrToken) if err != nil { return errors.Errorf("given token didn't match pattern %q or %q", - bootstrapapi.BootstrapTokenIDPattern, bootstrapapi.BootstrapTokenIDPattern) + bootstrapapi.BootstrapTokenPattern, bootstrapapi.BootstrapTokenIDPattern) } tokenID = bts.ID }