From 964854de9155c97b5567a0772be1c2dc4ad5239c 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 Upstream-commit: 0ef21eb0e30d2ea036730a7c5502f888c6b763d1 Component: engine --- components/engine/pkg/plugins/plugins.go | 6 ------ components/engine/pkg/plugins/plugins_linux.go | 7 +++++++ components/engine/pkg/plugins/plugins_windows.go | 8 ++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 components/engine/pkg/plugins/plugins_linux.go create mode 100644 components/engine/pkg/plugins/plugins_windows.go diff --git a/components/engine/pkg/plugins/plugins.go b/components/engine/pkg/plugins/plugins.go index 861daa3207..e60e0ee97b 100644 --- a/components/engine/pkg/plugins/plugins.go +++ b/components/engine/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/components/engine/pkg/plugins/plugins_linux.go b/components/engine/pkg/plugins/plugins_linux.go new file mode 100644 index 0000000000..9c5a0b5632 --- /dev/null +++ b/components/engine/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/components/engine/pkg/plugins/plugins_windows.go b/components/engine/pkg/plugins/plugins_windows.go new file mode 100644 index 0000000000..3c8d8feb83 --- /dev/null +++ b/components/engine/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 "" +}