Commit 5da34194 by Arve Knudsen Committed by GitHub

Better logging of plugin scanning errors (#30231)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
parent de3a7610
...@@ -204,11 +204,11 @@ func (pm *PluginManager) scan(pluginDir string, requireSigned bool) error { ...@@ -204,11 +204,11 @@ func (pm *PluginManager) scan(pluginDir string, requireSigned bool) error {
// 1st pass: Scan plugins, also mapping plugins to their respective directories // 1st pass: Scan plugins, also mapping plugins to their respective directories
if err := util.Walk(pluginDir, true, true, scanner.walker); err != nil { if err := util.Walk(pluginDir, true, true, scanner.walker); err != nil {
if errors.Is(err, os.ErrNotExist) { if errors.Is(err, os.ErrNotExist) {
pm.log.Debug("Couldn't scan directory since it doesn't exist", "pluginDir", pluginDir) pm.log.Debug("Couldn't scan directory since it doesn't exist", "pluginDir", pluginDir, "err", err)
return nil return nil
} }
if errors.Is(err, os.ErrPermission) { if errors.Is(err, os.ErrPermission) {
pm.log.Debug("Couldn't scan directory due to lack of permissions", "pluginDir", pluginDir) pm.log.Debug("Couldn't scan directory due to lack of permissions", "pluginDir", pluginDir, "err", err)
return nil return nil
} }
if pluginDir != "data/plugins" { if pluginDir != "data/plugins" {
...@@ -320,7 +320,7 @@ func (s *PluginScanner) walker(currentPath string, f os.FileInfo, err error) err ...@@ -320,7 +320,7 @@ func (s *PluginScanner) walker(currentPath string, f os.FileInfo, err error) err
// example https://github.com/raintank/worldping-app/tree/master/dist/grafana-worldmap-panel worldmap panel plugin // example https://github.com/raintank/worldping-app/tree/master/dist/grafana-worldmap-panel worldmap panel plugin
// is embedded in worldping app. // is embedded in worldping app.
if err != nil { if err != nil {
return err return fmt.Errorf("filepath.Walk reported an error for %q: %w", currentPath, err)
} }
if f.Name() == "node_modules" || f.Name() == "Chromium.app" { if f.Name() == "node_modules" || f.Name() == "Chromium.app" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment