[v11.2.x] Plugins: Avoid returning 404 for AutoEnabled apps (#93488)

Plugins: Avoid returning 404 for `AutoEnabled` apps (#93436)

avoid errors for autoenabled apps

(cherry picked from commit 362ffff591)

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-09-19 16:21:10 +03:00
committed by GitHub
co-authored by Will Browne
parent 1c7ac3ba1a
commit 7ca022d2a7
2 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -28,7 +28,13 @@ func checkAppEnabled(pluginStore pluginstore.Store, pluginSettings pluginsetting
})
if err != nil {
if errors.Is(err, pluginsettings.ErrPluginSettingNotFound) {
c.JsonApiErr(http.StatusNotFound, "Plugin not found", nil)
// If the plugin is auto enabled, we don't want to return an error because auto enabling allows us
// to enable plugins that are not explicitly configured.
if p.AutoEnabled {
return
}
c.JsonApiErr(http.StatusNotFound, "Plugin setting not found", nil)
return
}
c.JsonApiErr(http.StatusInternalServerError, "Failed to get plugin settings", err)