mirror of https://github.com/k3s-io/k3s
Rename PluginsEnvVarPluginLoader to stop stutter
parent
86f1d74a69
commit
91eaa8a308
|
@ -180,7 +180,7 @@ func (f *ring2Factory) NewUnstructuredBuilder(allowRemoteCalls bool) (*resource.
|
||||||
// system directory structure spec for the given platform.
|
// system directory structure spec for the given platform.
|
||||||
func (f *ring2Factory) PluginLoader() plugins.PluginLoader {
|
func (f *ring2Factory) PluginLoader() plugins.PluginLoader {
|
||||||
if len(os.Getenv("KUBECTL_PLUGINS_PATH")) > 0 {
|
if len(os.Getenv("KUBECTL_PLUGINS_PATH")) > 0 {
|
||||||
return plugins.PluginsEnvVarPluginLoader()
|
return plugins.KubectlPluginsPathPluginLoader()
|
||||||
}
|
}
|
||||||
return plugins.TolerantMultiPluginLoader{
|
return plugins.TolerantMultiPluginLoader{
|
||||||
plugins.XDGDataPluginLoader(),
|
plugins.XDGDataPluginLoader(),
|
||||||
|
|
|
@ -137,9 +137,9 @@ func PathFromEnvVarPluginLoader(envVarName string, subdirs ...string) PluginLoad
|
||||||
return loader
|
return loader
|
||||||
}
|
}
|
||||||
|
|
||||||
// PluginsEnvVarPluginLoader returns a PluginLoader that loads plugins from one or more
|
// KubectlPluginsPathPluginLoader returns a PluginLoader that loads plugins from one or more
|
||||||
// directories specified by the KUBECTL_PLUGINS_PATH env var.
|
// directories specified by the KUBECTL_PLUGINS_PATH env var.
|
||||||
func PluginsEnvVarPluginLoader() PluginLoader {
|
func KubectlPluginsPathPluginLoader() PluginLoader {
|
||||||
return PathFromEnvVarPluginLoader("KUBECTL_PLUGINS_PATH")
|
return PathFromEnvVarPluginLoader("KUBECTL_PLUGINS_PATH")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ func TestUnexistentDirectoryPluginLoader(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPluginsEnvVarPluginLoader(t *testing.T) {
|
func TestKubectlPluginsPathPluginLoader(t *testing.T) {
|
||||||
tmp, err := setupValidPlugins(1, 0)
|
tmp, err := setupValidPlugins(1, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
@ -120,7 +120,7 @@ func TestPluginsEnvVarPluginLoader(t *testing.T) {
|
||||||
os.Setenv(env, tmp)
|
os.Setenv(env, tmp)
|
||||||
defer os.Unsetenv(env)
|
defer os.Unsetenv(env)
|
||||||
|
|
||||||
loader := PluginsEnvVarPluginLoader()
|
loader := KubectlPluginsPathPluginLoader()
|
||||||
|
|
||||||
plugins, err := loader.Load()
|
plugins, err := loader.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue