add missing errchecks

This commit is contained in:
iwilltry42 2019-09-26 18:19:34 +02:00
parent ac43655396
commit 8c965a9f16
4 changed files with 14 additions and 4 deletions

View File

@ -22,6 +22,7 @@ THE SOFTWARE.
package create
import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@ -34,7 +35,10 @@ func NewCmdCreate() *cobra.Command {
Short: "Create a resource [cluster, node].",
Long: `Create a resource [cluster, node].`,
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
if err := cmd.Help(); err != nil {
log.Errorln("Couldn't get help text")
log.Fatalln(err)
}
},
}

View File

@ -41,7 +41,9 @@ func NewCmdCreateCluster() *cobra.Command {
Long: `Create a new k3s cluster with containerized nodes (k3s in docker).`,
Run: func(cmd *cobra.Command, args []string) {
runtime, cluster := parseCmd(cmd, args)
k3dCluster.CreateCluster(cluster, runtime)
if err := k3dCluster.CreateCluster(cluster, runtime); err != nil {
log.Fatalln(err)
}
},
}

View File

@ -43,7 +43,9 @@ func NewCmdCreateNode() *cobra.Command {
if err != nil {
log.Debugln("runtime not defined")
}
cluster.CreateNode(&k3d.Node{}, rt)
if err := cluster.CreateNode(&k3d.Node{}, rt); err != nil {
log.Fatalln(err)
}
},
}

View File

@ -42,7 +42,9 @@ func NewCmdDeleteNode() *cobra.Command {
if err != nil {
log.Debugln("runtime not defined")
}
cluster.DeleteNode(&k3d.Node{Name: "test"}, rt)
if err := cluster.DeleteNode(&k3d.Node{Name: "test"}, rt); err != nil {
log.Fatalln(err)
}
},
}