diff --git a/cmd/root.go b/cmd/root.go index b875727c4..5a3badf1d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -41,8 +41,9 @@ func NewRootCmd(out io.Writer, client *kube.Client, args []string) (*cobra.Comma // Execute runs the base airshipctl command func Execute(out io.Writer) { - client, err := kube.NewForConfig(settings.KubeConfigFilePath) - osExitIfError(out, err) + // TODO(howell): Fix this unused error + client, _ := kube.NewForConfig(settings.KubeConfigFilePath) + rootCmd, err := NewRootCmd(out, client, os.Args[1:]) osExitIfError(out, err) osExitIfError(out, rootCmd.Execute()) diff --git a/cmd/version.go b/cmd/version.go index 242977095..307c3a97a 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -45,6 +45,9 @@ func clientVersion() string { } func kubeVersion(client *kube.Client) (string, error) { + if client == nil { + return "could not connect to a kubernetes cluster", nil + } version, err := client.Discovery().ServerVersion() if err != nil { return "", err