Browse Source

Add nil check to operator autopilot endpoint

pull/2897/head
Kyle Havlovitz 8 years ago
parent
commit
76d96e2eb0
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
  1. 2
      consul/leader.go
  2. 3
      consul/operator_autopilot_endpoint.go

2
consul/leader.go

@ -259,7 +259,7 @@ func (s *Server) getOrCreateAutopilotConfig() (*structs.AutopilotConfig, bool) {
}
if !ServersMeetMinimumVersion(s.LANMembers(), minAutopilotVersion) {
s.logger.Printf("[ERR] autopilot: can't initialize until all servers are >= %s", minAutopilotVersion.String())
s.logger.Printf("[WARN] autopilot: can't initialize until all servers are >= %s", minAutopilotVersion.String())
return nil, false
}

3
consul/operator_autopilot_endpoint.go

@ -26,6 +26,9 @@ func (op *Operator) AutopilotGetConfiguration(args *structs.DCSpecificRequest, r
if err != nil {
return err
}
if config == nil {
return fmt.Errorf("autopilot config not initialized yet")
}
*reply = *config

Loading…
Cancel
Save