mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
cmd/dockerd: explicitly access Config fields
Explicitly access config field through the Config field, instead of the top-level "cli". This allows spotting locations where we don't depend on the CLI, but really just the Config. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -1040,7 +1040,7 @@ func (cli *daemonCLI) initializeContainerd(ctx context.Context) (func(time.Durat
|
||||
}
|
||||
if ok {
|
||||
// detected a system containerd at the given address.
|
||||
cli.ContainerdAddr = systemContainerdAddr
|
||||
cli.Config.ContainerdAddr = systemContainerdAddr
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -1050,11 +1050,11 @@ func (cli *daemonCLI) initializeContainerd(ctx context.Context) (func(time.Durat
|
||||
return nil, errors.Wrap(err, "failed to generate containerd options")
|
||||
}
|
||||
|
||||
r, err := supervisor.Start(ctx, filepath.Join(cli.Root, "containerd"), filepath.Join(cli.ExecRoot, "containerd"), opts...)
|
||||
r, err := supervisor.Start(ctx, filepath.Join(cli.Config.Root, "containerd"), filepath.Join(cli.Config.ExecRoot, "containerd"), opts...)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to start containerd")
|
||||
}
|
||||
cli.ContainerdAddr = r.Address()
|
||||
cli.Config.ContainerdAddr = r.Address()
|
||||
|
||||
// Try to wait for containerd to shutdown
|
||||
return r.WaitTimeout, nil
|
||||
|
||||
@@ -115,7 +115,7 @@ func newCgroupParent(cfg *config.Config) string {
|
||||
}
|
||||
|
||||
func (cli *daemonCLI) initContainerd(ctx context.Context) (func(time.Duration) error, error) {
|
||||
if cli.ContainerdAddr != "" {
|
||||
if cli.Config.ContainerdAddr != "" {
|
||||
// use system containerd at the given address.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -101,13 +101,13 @@ func newCgroupParent(*config.Config) string {
|
||||
}
|
||||
|
||||
func (cli *daemonCLI) initContainerd(ctx context.Context) (func(time.Duration) error, error) {
|
||||
defer func() { system.EnableContainerdRuntime(cli.ContainerdAddr) }()
|
||||
defer func() { system.EnableContainerdRuntime(cli.Config.ContainerdAddr) }()
|
||||
|
||||
if cli.ContainerdAddr != "" {
|
||||
if cli.Config.ContainerdAddr != "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if cli.DefaultRuntime != config.WindowsV2RuntimeName {
|
||||
if cli.Config.DefaultRuntime != config.WindowsV2RuntimeName {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user