Plugins: Separate manager read/write components (#50313)

* separate manager read/write

* guarantee consistency in test
This commit is contained in:
Will Browne authored and GitHub committed 2022-06-07 17:51:00 +02:00
1 parent aa74371008
commit f7cce28cdf
5 files changed
+15 -3

No files matched your search

+2 -2
View File
@@ -358,7 +358,7 @@ func (hs *HTTPServer) InstallPlugin(c *models.ReqContext) response.Response {
}
pluginID := web.Params(c.Req)[":pluginId"]
err := hs.pluginStore.Add(c.Req.Context(), pluginID, dto.Version)
err := hs.pluginManager.Add(c.Req.Context(), pluginID, dto.Version)
if err != nil {
var dupeErr plugins.DuplicateError
if errors.As(err, &dupeErr) {
@@ -389,7 +389,7 @@ func (hs *HTTPServer) InstallPlugin(c *models.ReqContext) response.Response {
func (hs *HTTPServer) UninstallPlugin(c *models.ReqContext) response.Response {
pluginID := web.Params(c.Req)[":pluginId"]
err := hs.pluginStore.Remove(c.Req.Context(), pluginID)
err := hs.pluginManager.Remove(c.Req.Context(), pluginID)
if err != nil {
if errors.Is(err, plugins.ErrPluginNotInstalled) {
return response.Error(http.StatusNotFound, "Plugin not installed", err)