check error on generating tls context

This commit is contained in:
Chelsea Holland Komlo
2017-11-29 12:54:05 -05:00
parent c65857c431
commit bee883c4e0

View File

@@ -239,6 +239,9 @@ func NewServer(config *Config, consulCatalog consul.CatalogAPI, logger *log.Logg
// Configure TLS
tlsConf := config.tlsConfig()
incomingTLS, tlsWrap, err := getTLSConf(config.TLSConfig.EnableRPC, tlsConf)
if err != nil {
return nil, err
}
// Create the ACL object cache
aclCache, err := lru.New2Q(aclCacheSize)
@@ -382,11 +385,16 @@ func (s *Server) ReloadTLSConnections(newTLSConfig *config.TLSConfig) error {
tlsConf := s.config.tlsConfig()
incomingTLS, tlsWrap, err := getTLSConf(s.config.TLSConfig.EnableRPC, tlsConf)
if err != nil {
s.logger.Printf("[ERR] nomad: unable to reset TLS context")
return err
}
if s.rpcCancel == nil {
s.logger.Printf("[ERR] nomad: No TLS Context to reset")
return fmt.Errorf("Unable to reset tls context")
}
s.rpcCancel()
s.rpcTLSLock.Lock()