|
|
|
|
@ -49,7 +49,7 @@ func (l *Local) Find(ctx context.Context, src plugins.PluginSource) ([]*plugins. |
|
|
|
|
for _, path := range pluginURIs { |
|
|
|
|
exists, err := fs.Exists(path) |
|
|
|
|
if err != nil { |
|
|
|
|
l.log.Warn("Skipping finding plugins as an error occurred", "path", path, "err", err) |
|
|
|
|
l.log.Warn("Skipping finding plugins as an error occurred", "path", path, "error", err) |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
if !exists { |
|
|
|
|
@ -69,13 +69,13 @@ func (l *Local) Find(ctx context.Context, src plugins.PluginSource) ([]*plugins. |
|
|
|
|
for _, pluginJSONPath := range pluginJSONPaths { |
|
|
|
|
plugin, err := l.readPluginJSON(pluginJSONPath) |
|
|
|
|
if err != nil { |
|
|
|
|
l.log.Warn("Skipping plugin loading as its plugin.json could not be read", "path", pluginJSONPath, "err", err) |
|
|
|
|
l.log.Warn("Skipping plugin loading as its plugin.json could not be read", "path", pluginJSONPath, "error", err) |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pluginJSONAbsPath, err := filepath.Abs(pluginJSONPath) |
|
|
|
|
if err != nil { |
|
|
|
|
l.log.Warn("Skipping plugin loading as absolute plugin.json path could not be calculated", "pluginID", plugin.ID, "err", err) |
|
|
|
|
l.log.Warn("Skipping plugin loading as absolute plugin.json path could not be calculated", "pluginId", plugin.ID, "error", err) |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -138,16 +138,16 @@ func (l *Local) readPluginJSON(pluginJSONPath string) (plugins.JSONData, error) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if err = reader.Close(); err != nil { |
|
|
|
|
l.log.Warn("Failed to close plugin JSON file", "path", pluginJSONPath, "err", err) |
|
|
|
|
l.log.Warn("Failed to close plugin JSON file", "path", pluginJSONPath, "error", err) |
|
|
|
|
} |
|
|
|
|
}() |
|
|
|
|
if err != nil { |
|
|
|
|
l.log.Warn("Skipping plugin loading as its plugin.json could not be read", "path", pluginJSONPath, "err", err) |
|
|
|
|
l.log.Warn("Skipping plugin loading as its plugin.json could not be read", "path", pluginJSONPath, "error", err) |
|
|
|
|
return plugins.JSONData{}, err |
|
|
|
|
} |
|
|
|
|
plugin, err := plugins.ReadPluginJSON(reader) |
|
|
|
|
if err != nil { |
|
|
|
|
l.log.Warn("Skipping plugin loading as its plugin.json could not be read", "path", pluginJSONPath, "err", err) |
|
|
|
|
l.log.Warn("Skipping plugin loading as its plugin.json could not be read", "path", pluginJSONPath, "error", err) |
|
|
|
|
return plugins.JSONData{}, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -167,11 +167,11 @@ func (l *Local) getAbsPluginJSONPaths(path string) ([]string, error) { |
|
|
|
|
func(currentPath string, fi os.FileInfo, err error) error { |
|
|
|
|
if err != nil { |
|
|
|
|
if errors.Is(err, os.ErrNotExist) { |
|
|
|
|
l.log.Error("Couldn't scan directory since it doesn't exist", "pluginDir", path, "err", err) |
|
|
|
|
l.log.Error("Couldn't scan directory since it doesn't exist", "pluginDir", path, "error", err) |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
if errors.Is(err, os.ErrPermission) { |
|
|
|
|
l.log.Error("Couldn't scan directory due to lack of permissions", "pluginDir", path, "err", err) |
|
|
|
|
l.log.Error("Couldn't scan directory due to lack of permissions", "pluginDir", path, "error", err) |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|