mirror of
https://github.com/grafana/grafana.git
synced 2026-08-26 21:37:31 -05:00
Plugins: Do not fail bootstrap stage if single decorate step fails (#73147)
* don't fail all if decorate step fails * fix casing * include err too * cover pluginsintegration too
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ func (l *Loader) Load(ctx context.Context, src plugins.PluginSource) ([]*plugins
|
||||
return nil, err
|
||||
}
|
||||
|
||||
verifiedPlugins, err := l.validation.Validate(ctx, bootstrappedPlugins)
|
||||
validatedPlugins, err := l.validation.Validate(ctx, bootstrappedPlugins)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
initializedPlugins, err := l.initializer.Initialize(ctx, verifiedPlugins)
|
||||
initializedPlugins, err := l.initializer.Initialize(ctx, validatedPlugins)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user