kubeadm: fix to avoid panic if token not provided

Prior to this, kubeadm would panic if no token was provided. This does a
check and prints out a more reasonable message.
This commit is contained in:
Derek McQuay 2017-02-13 09:59:33 -08:00
parent beaf5ffacc
commit ff5801ad0c
No known key found for this signature in database
GPG Key ID: 92A7BC0C86B0B91A

View File

@ -92,6 +92,9 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
Use: "delete", Use: "delete",
Short: "Delete bootstrap tokens on the server.", Short: "Delete bootstrap tokens on the server.",
Run: func(tokenCmd *cobra.Command, args []string) { 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]) err := RunDeleteToken(out, tokenCmd, args[0])
kubeadmutil.CheckErr(err) kubeadmutil.CheckErr(err)
}, },