Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn to stderr when we encounter PathError listing plugins #76707

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/kubectl/cmd/plugin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)

Expand Down
5 changes: 2 additions & 3 deletions pkg/kubectl/cmd/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if pathErr, ok := err.(*os.PathError); ok {

}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, since all I need from the bug is its string.

fmt.Fprintf(o.ErrOut, "Unable read directory %q from your PATH: %v. Skipping...", dir, err)
continue
}

Expand Down