From e9779fd7df2d84d90477a0e714e77a24b5f7acfa Mon Sep 17 00:00:00 2001 From: Anusha Ragunathan Date: Fri, 13 Jan 2017 14:03:51 -0800 Subject: [PATCH] Fix pluginv1 Windows volumes c54b717 caused a regression for pluginv1 on Windows, where extraneous backslashes were added to BasePath of the plugin. For pluginv1 on windows, BasePath() should return an empty string, since the plugin is fully aware of the mount path. Also, unlike Linux where all paths are relative to "/", Windows paths are dependent on system drives and mapped drives. Fixes #30148 Signed-off-by: Anusha Ragunathan (cherry picked from commit 0ef21eb0e30d2ea036730a7c5502f888c6b763d1) Signed-off-by: Victor Vieux --- pkg/plugins/plugins.go | 6 ------ pkg/plugins/plugins_linux.go | 7 +++++++ pkg/plugins/plugins_windows.go | 8 ++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 pkg/plugins/plugins_linux.go create mode 100644 pkg/plugins/plugins_windows.go diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index 861daa3207..e60e0ee97b 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -78,12 +78,6 @@ type Plugin struct { handlersRun bool } -// BasePath returns the path to which all paths returned by the plugin are relative to. -// For v1 plugins, this always returns the host's root directory. -func (p *Plugin) BasePath() string { - return "/" -} - // Name returns the name of the plugin. func (p *Plugin) Name() string { return p.name diff --git a/pkg/plugins/plugins_linux.go b/pkg/plugins/plugins_linux.go new file mode 100644 index 0000000000..9c5a0b5632 --- /dev/null +++ b/pkg/plugins/plugins_linux.go @@ -0,0 +1,7 @@ +package plugins + +// BasePath returns the path to which all paths returned by the plugin are relative to. +// For v1 plugins, this always returns the host's root directory. +func (p *Plugin) BasePath() string { + return "/" +} diff --git a/pkg/plugins/plugins_windows.go b/pkg/plugins/plugins_windows.go new file mode 100644 index 0000000000..3c8d8feb83 --- /dev/null +++ b/pkg/plugins/plugins_windows.go @@ -0,0 +1,8 @@ +package plugins + +// BasePath returns the path to which all paths returned by the plugin are relative to. +// For Windows v1 plugins, this returns an empty string, since the plugin is already aware +// of the absolute path of the mount. +func (p *Plugin) BasePath() string { + return "" +}