mirror of
https://github.com/docker/cli.git
synced 2026-09-27 17:56:04 -04:00
Merge pull request #36306 from cpuguy83/fix_logopt_validator_plugins
Move log validator logic after plugins are loaded Upstream-commit: 04d97267b6b57987030862c0d355c9a49eb0e445 Component: engine
This commit is contained in:
@@ -671,8 +671,6 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
|
||||
return nil, fmt.Errorf("error setting default isolation mode: %v", err)
|
||||
}
|
||||
|
||||
logrus.Debugf("Using default logging driver %s", config.LogConfig.Type)
|
||||
|
||||
if err := configureMaxThreads(config); err != nil {
|
||||
logrus.Warnf("Failed to configure golang's threads limit: %v", err)
|
||||
}
|
||||
@@ -753,6 +751,10 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
|
||||
return nil, errors.Wrap(err, "couldn't create plugin manager")
|
||||
}
|
||||
|
||||
if err := d.setupDefaultLogConfig(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for operatingSystem, gd := range d.graphDrivers {
|
||||
d.layerStores[operatingSystem], err = layer.NewStoreFromOptions(layer.StoreOptions{
|
||||
Root: config.Root,
|
||||
@@ -873,10 +875,7 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
|
||||
d.trustKey = trustKey
|
||||
d.idIndex = truncindex.NewTruncIndex([]string{})
|
||||
d.statsCollector = d.newStatsCollector(1 * time.Second)
|
||||
d.defaultLogConfig = containertypes.LogConfig{
|
||||
Type: config.LogConfig.Type,
|
||||
Config: config.LogConfig.Config,
|
||||
}
|
||||
|
||||
d.EventsService = eventsService
|
||||
d.volumes = volStore
|
||||
d.root = config.Root
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package daemon // import "github.com/docker/docker/daemon"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -14,6 +13,7 @@ import (
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -184,3 +184,18 @@ func (daemon *Daemon) mergeAndVerifyLogConfig(cfg *containertypes.LogConfig) err
|
||||
|
||||
return logger.ValidateLogOpts(cfg.Type, cfg.Config)
|
||||
}
|
||||
|
||||
func (daemon *Daemon) setupDefaultLogConfig() error {
|
||||
config := daemon.configStore
|
||||
if len(config.LogConfig.Config) > 0 {
|
||||
if err := logger.ValidateLogOpts(config.LogConfig.Type, config.LogConfig.Config); err != nil {
|
||||
return errors.Wrap(err, "failed to set log opts")
|
||||
}
|
||||
}
|
||||
daemon.defaultLogConfig = containertypes.LogConfig{
|
||||
Type: config.LogConfig.Type,
|
||||
Config: config.LogConfig.Config,
|
||||
}
|
||||
logrus.Debugf("Using default logging driver %s", daemon.defaultLogConfig.Type)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user