mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
Merge pull request #41342 from apprenda/kubeadm_token_panic_fix
Automatic merge from submit-queue (batch tested with PRs 41342, 41257) kubeadm: fix to avoid panic if token not provided **What this PR does / why we need it**: Prior to this, kubeadm would panic if no token was provided running `kubeadm ex token delete`. This does a check to verify an arg has been passed and prints out a more reasonable message if it is not provided. **Special notes for your reviewer**: /cc @luxas @pires **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -92,6 +92,9 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
|
||||
Use: "delete",
|
||||
Short: "Delete bootstrap tokens on the server.",
|
||||
Run: func(tokenCmd *cobra.Command, args []string) {
|
||||
if len(args) < 1 {
|
||||
kubeadmutil.CheckErr(fmt.Errorf("missing subcommand; 'token delete' is missing token of form [\"^([a-z0-9]{6})$\"]"))
|
||||
}
|
||||
err := RunDeleteToken(out, tokenCmd, args[0])
|
||||
kubeadmutil.CheckErr(err)
|
||||
},
|
||||
|
Reference in New Issue
Block a user