Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daemon: getPluginExecRoot(): pass config #44310

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,13 +903,13 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
}
rt = *rtPtr
}
return pluginexec.New(ctx, getPluginExecRoot(config.Root), pluginCli, config.ContainerdPluginNamespace, m, rt)
return pluginexec.New(ctx, getPluginExecRoot(config), pluginCli, config.ContainerdPluginNamespace, m, rt)
}

// Plugin system initialization should happen before restore. Do not change order.
d.pluginManager, err = plugin.NewManager(plugin.ManagerConfig{
Root: filepath.Join(config.Root, "plugins"),
ExecRoot: getPluginExecRoot(config.Root),
ExecRoot: getPluginExecRoot(config),
Store: d.PluginStore,
CreateExecutor: createPluginExec,
RegistryService: registryService,
Expand Down
2 changes: 1 addition & 1 deletion daemon/daemon_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// instead of deriving path from daemon's exec-root. This is because
// plugin socket files are created here and they cannot exceed max
// path length of 108 bytes.
func getPluginExecRoot(root string) string {
func getPluginExecRoot(_ *config.Config) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun fact: if all args are unused, you can elide the names completely.

Suggested change
func getPluginExecRoot(_ *config.Config) string {
func getPluginExecRoot(*config.Config) string {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! TIL didn't know that!

return "/run/docker/plugins"
}

Expand Down
4 changes: 2 additions & 2 deletions daemon/daemon_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func adjustParallelLimit(n int, limit int) int {
}

// Windows has no concept of an execution state directory. So use config.Root here.
func getPluginExecRoot(root string) string {
return filepath.Join(root, "plugins")
func getPluginExecRoot(cfg *config.Config) string {
return filepath.Join(cfg.Root, "plugins")
}

func (daemon *Daemon) parseSecurityOpt(container *container.Container, hostConfig *containertypes.HostConfig) error {
Expand Down