[v11.2.x] Plugins: Skip install errors if dependency plugin already exists (#94717)

Plugins: Skip install errors if dependency plugin already exists (#94710)

* skip install errors if dependency plugin already exists

* add test

(cherry picked from commit f97f489c2c)

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-10-15 13:54:47 +03:00
committed by GitHub
co-authored by Will Browne
parent da025b1bd3
commit 3965e68c8d
2 changed files with 49 additions and 0 deletions
+5
View File
@@ -75,6 +75,11 @@ func (m *PluginInstaller) Add(ctx context.Context, pluginID, version string, opt
err = m.Add(ctx, dep.ID, dep.Version, opts)
if err != nil {
var dupeErr plugins.DuplicateError
if errors.As(err, &dupeErr) {
m.log.Info("Dependency already installed", "pluginId", dep.ID)
continue
}
return fmt.Errorf("%v: %w", fmt.Sprintf("failed to download plugin %s from repository", dep.ID), err)
}
}