cluster: Proceed with startup if cluster component can't be created

The current behavior is for dockerd to fail to start if the swarm
component can't be started for some reason. This can be difficult to
debug remotely because the daemon won't be running at all, so it's not
possible to hit endpoints like /info to see what's going on. It's also
very difficult to recover from the situation, since commands like
"docker swarm leave" are unavailable.

Change the behavior to allow startup to proceed.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: f7d846094a5dc642198cc4939df646a3e889a750
Component: engine
This commit is contained in:
Aaron Lehmann
2017-03-07 16:50:39 -08:00
parent 569aaf9edd
commit 642bdd2e30
+2 -8
View File
@@ -39,7 +39,6 @@ package cluster
//
import (
"crypto/x509"
"fmt"
"net"
"os"
@@ -171,13 +170,8 @@ func New(config Config) (*Cluster, error) {
logrus.Error("swarm component could not be started before timeout was reached")
case err := <-nr.Ready():
if err != nil {
if errors.Cause(err) == errSwarmLocked {
return c, nil
}
if err, ok := errors.Cause(c.nr.err).(x509.CertificateInvalidError); ok && err.Reason == x509.Expired {
return c, nil
}
return nil, errors.Wrap(err, "swarm component could not be started")
logrus.WithError(err).Error("swarm component could not be started")
return c, nil
}
}
return c, nil