Plugins: Simplify plugin file removal (#66115)

* make explicit class check when attempting to remove plugin

* simplify plugin file tracking

* fix test

* apply feedback

* fix linter
This commit is contained in:
Will Browne
2023-04-20 11:52:59 +02:00
committed by GitHub
parent 6e8b17efd8
commit 739c7f1c68
15 changed files with 193 additions and 281 deletions
@@ -84,7 +84,7 @@ func installPlugin(ctx context.Context, pluginID, version string, c utils.Comman
}
pluginFs := storage.FileSystem(services.Logger, c.PluginDirectory())
extractedArchive, err := pluginFs.Add(ctx, pluginID, archive.File)
extractedArchive, err := pluginFs.Extract(ctx, pluginID, archive.File)
if err != nil {
return err
}
@@ -96,7 +96,7 @@ func installPlugin(ctx context.Context, pluginID, version string, c utils.Comman
return fmt.Errorf("%v: %w", fmt.Sprintf("failed to download plugin %s from repository", dep.ID), err)
}
_, err = pluginFs.Add(ctx, dep.ID, d.File)
_, err = pluginFs.Extract(ctx, dep.ID, d.File)
if err != nil {
return err
}