mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
make missing-directory errors non fatal
This commit is contained in:
parent
d388b3eea7
commit
de015167a9
@ -11,6 +11,7 @@ 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",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -28,6 +28,7 @@ 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"
|
||||
@ -117,6 +118,11 @@ 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)
|
||||
continue
|
||||
}
|
||||
|
||||
pluginErrors = append(pluginErrors, fmt.Errorf("error: unable to read directory %q in your PATH: %v", dir, err))
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user