1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Don't fail to start daemon if builder source is not available

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2018-06-13 09:33:19 -07:00
parent 692df4699c
commit ca3e3fcf7e

View file

@ -37,6 +37,7 @@ import (
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus"
) )
// Opt defines a structure for creating a worker. // Opt defines a structure for creating a worker.
@ -77,32 +78,33 @@ func NewWorker(opt Opt) (*Worker, error) {
CacheAccessor: cm, CacheAccessor: cm,
MetadataStore: opt.MetadataStore, MetadataStore: opt.MetadataStore,
}) })
if err != nil { if err == nil {
return nil, err sm.Register(gs)
} else {
logrus.Warnf("Could not register builder git source: %s", err)
} }
sm.Register(gs)
hs, err := http.NewSource(http.Opt{ hs, err := http.NewSource(http.Opt{
CacheAccessor: cm, CacheAccessor: cm,
MetadataStore: opt.MetadataStore, MetadataStore: opt.MetadataStore,
Transport: opt.Transport, Transport: opt.Transport,
}) })
if err != nil { if err == nil {
return nil, err sm.Register(hs)
} else {
logrus.Warnf("Could not register builder http source: %s", err)
} }
sm.Register(hs)
ss, err := local.NewSource(local.Opt{ ss, err := local.NewSource(local.Opt{
SessionManager: opt.SessionManager, SessionManager: opt.SessionManager,
CacheAccessor: cm, CacheAccessor: cm,
MetadataStore: opt.MetadataStore, MetadataStore: opt.MetadataStore,
}) })
if err != nil { if err == nil {
return nil, err sm.Register(ss)
} else {
logrus.Warnf("Could not register builder local source: %s", err)
} }
sm.Register(ss)
return &Worker{ return &Worker{
Opt: opt, Opt: opt,