Skip to content

Commit 1c71a23

Browse files
committed
Warn to stderr when we encounter PathError listing plugins
1 parent b359b6b commit 1c71a23

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

pkg/kubectl/cmd/plugin/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ go_library(
1111
"//pkg/kubectl/util/templates:go_default_library",
1212
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
1313
"//vendor/github.com/spf13/cobra:go_default_library",
14-
"//vendor/k8s.io/klog:go_default_library",
1514
],
1615
)
1716

pkg/kubectl/cmd/plugin/plugin.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/spf13/cobra"
2929

3030
"k8s.io/cli-runtime/pkg/genericclioptions"
31-
"k8s.io/klog"
3231
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
3332
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
3433
"k8s.io/kubernetes/pkg/kubectl/util/templates"
@@ -116,8 +115,8 @@ func (o *PluginListOptions) Run() error {
116115
for _, dir := range uniquePathsList(o.PluginPaths) {
117116
files, err := ioutil.ReadDir(dir)
118117
if err != nil {
119-
if _, ok := err.(*os.PathError); ok && strings.Contains(err.Error(), "no such file") {
120-
klog.V(3).Infof("unable to find directory %q in your PATH. Skipping...", dir)
118+
if _, ok := err.(*os.PathError); ok {
119+
fmt.Fprintf(o.ErrOut, "Unable read directory %q from your PATH: %v. Skipping...", dir, err)
121120
continue
122121
}
123122

0 commit comments

Comments
 (0)