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

* separate manager read/write

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

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)