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

Eliminate redundant parameters

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
This commit is contained in:
Yanqiang Miao 2016-11-22 19:40:54 +08:00
parent 3373227f36
commit 58028a2919
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.
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)
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{
Config: cfg.Config,
@ -1050,9 +1051,9 @@ func (container *Container) startLogging() error {
return nil // do not start logging routines
}
l, err := container.StartLogger(container.HostConfig.LogConfig)
l, err := container.StartLogger()
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)

View file

@ -117,7 +117,7 @@ func (daemon *Daemon) getLogger(container *container.Container) (logger.Logger,
if container.LogDriver != nil && container.IsRunning() {
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.

View file

@ -4515,7 +4515,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
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
c.Assert(waitForGoroutines(nroutines), checker.IsNil)