Plugins: Make Installer responsible for removing plugins from file system (#73323)

* installer is responsible for removing from file system

* take plugin as arg

* remove resolve step

* return plugin in test
This commit is contained in:
Will Browne
2023-08-16 15:44:20 +02:00
committed by GitHub
parent 243b757168
commit 3c50db328d
13 changed files with 64 additions and 106 deletions

View File

@ -145,9 +145,17 @@ func (m *PluginInstaller) Remove(ctx context.Context, pluginID string) error {
return plugins.ErrUninstallCorePlugin
}
if err := m.pluginLoader.Unload(ctx, plugin.ID); err != nil {
p, err := m.pluginLoader.Unload(ctx, plugin)
if err != nil {
return err
}
if remover, ok := p.FS.(plugins.FSRemover); ok {
if err = remover.Remove(); err != nil {
return err
}
}
return nil
}