Add nil check to operator autopilot endpoint

This commit is contained in:
Kyle Havlovitz 2017-04-13 10:43:07 -07:00
parent 196dd81cc5
commit 76d96e2eb0
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
2 changed files with 4 additions and 1 deletions

View File

@ -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
}

View File

@ -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