Guard against nil etcd response header
package cluster
import (
+ "errors"
"fmt"
"io"
@@ -23,6 +24,9 @@ func HealthCommand(cli *cli.SensuCli) *cobra.Command {
if err != nil {
return err
}
+ if result.Header == nil {
+ return errors.New("result header was empty, etcd cluster may be down")
+ }
err = helpers.PrintTitle(helpers.GetChangedStringValueFlag("format", cmd.Flags()), cli.Config.Format(), fmt.Sprintf("Etcd Cluster ID: %x", result.Header.ClusterId), cmd.OutOrStdout())
if err != nil {
return err
