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

Merge pull request #28710 from miaoyq/eliminate-redundant-parameters

Eliminate the redundant parameter
This commit is contained in:
Antonio Murdaca 2016-11-26 14:37:17 +01:00 committed by GitHub
commit 76a0dfaa8e
3 changed files with 7 additions and 6 deletions

View file

@ -322,10 +322,11 @@ func (container *Container) CheckpointDir() string {
} }
// StartLogger starts a new logger driver for the container. // StartLogger starts a new logger driver for the container.
func (container *Container) StartLogger(cfg containertypes.LogConfig) (logger.Logger, error) { func (container *Container) StartLogger() (logger.Logger, error) {
cfg := container.HostConfig.LogConfig
c, err := logger.GetLogDriver(cfg.Type) c, err := logger.GetLogDriver(cfg.Type)
if err != nil { if err != nil {
return nil, fmt.Errorf("Failed to get logging factory: %v", err) return nil, fmt.Errorf("failed to get logging factory: %v", err)
} }
ctx := logger.Context{ ctx := logger.Context{
Config: cfg.Config, Config: cfg.Config,
@ -1050,9 +1051,9 @@ func (container *Container) startLogging() error {
return nil // do not start logging routines return nil // do not start logging routines
} }
l, err := container.StartLogger(container.HostConfig.LogConfig) l, err := container.StartLogger()
if err != nil { if err != nil {
return fmt.Errorf("Failed to initialize logging driver: %v", err) return fmt.Errorf("failed to initialize logging driver: %v", err)
} }
copier := logger.NewCopier(map[string]io.Reader{"stdout": container.StdoutPipe(), "stderr": container.StderrPipe()}, l) copier := logger.NewCopier(map[string]io.Reader{"stdout": container.StdoutPipe(), "stderr": container.StderrPipe()}, l)

View file

@ -117,7 +117,7 @@ func (daemon *Daemon) getLogger(container *container.Container) (logger.Logger,
if container.LogDriver != nil && container.IsRunning() { if container.LogDriver != nil && container.IsRunning() {
return container.LogDriver, nil return container.LogDriver, nil
} }
return container.StartLogger(container.HostConfig.LogConfig) return container.StartLogger()
} }
// mergeLogConfig merges the daemon log config to the container's log config if the container's log driver is not specified. // mergeLogConfig merges the daemon log config to the container's log config if the container's log driver is not specified.

View file

@ -4497,7 +4497,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true") out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
c.Assert(err, checker.NotNil) c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, "Failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out)) c.Assert(out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
// NGoroutines is not updated right away, so we need to wait before failing // NGoroutines is not updated right away, so we need to wait before failing
c.Assert(waitForGoroutines(nroutines), checker.IsNil) c.Assert(waitForGoroutines(nroutines), checker.IsNil)