Warn to stderr when we encounter PathError listing plugins

k3s-v1.15.3
Maciej Szulik 2019-04-17 14:52:10 +02:00
parent b359b6bfe7
commit 1c71a2312b
No known key found for this signature in database
GPG Key ID: F15E55D276FA84C4
2 changed files with 2 additions and 4 deletions

View File

@ -11,7 +11,6 @@ go_library(
"//pkg/kubectl/util/templates:go_default_library",
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
"//vendor/github.com/spf13/cobra:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@ -28,7 +28,6 @@ import (
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/klog"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
"k8s.io/kubernetes/pkg/kubectl/util/templates"
@ -116,8 +115,8 @@ func (o *PluginListOptions) Run() error {
for _, dir := range uniquePathsList(o.PluginPaths) {
files, err := ioutil.ReadDir(dir)
if err != nil {
if _, ok := err.(*os.PathError); ok && strings.Contains(err.Error(), "no such file") {
klog.V(3).Infof("unable to find directory %q in your PATH. Skipping...", dir)
if _, ok := err.(*os.PathError); ok {
fmt.Fprintf(o.ErrOut, "Unable read directory %q from your PATH: %v. Skipping...", dir, err)
continue
}