Prevent panic if autopilot health is requested prior to leader establishment finishing. (#9204)

pull/9207/head
Matt Keeler 4 years ago committed by GitHub
parent a7d504478c
commit 748d56b8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
```release-note:bug
autopilot: Prevent panic when requesting the autopilot health immediately after a leader is elected.
```

@ -100,6 +100,12 @@ func (op *Operator) ServerHealth(args *structs.DCSpecificRequest, reply *structs
state := op.srv.autopilot.GetState()
if state == nil {
// this behavior seems odd but its functionally equivalent to 1.8.5 where if
// autopilot didn't have a health reply yet it would just return no error
return nil
}
health := structs.AutopilotHealthReply{
Healthy: state.Healthy,
FailureTolerance: state.FailureTolerance,

Loading…
Cancel
Save