MM-18517: Plugin Marketplace (Phase 2) (#13086)
* MM-17549: use StatusNotFound when deleting plugin (#12983) Trying to delete a plugin that does not exist should fail with a 404, not a 400. Relates-to: https://mattermost.atlassian.net/browse/MM-17549 * MM-19630: marketplace: model ReleaseNotesURL (#13083) Automatic Merge * MM-20065: allow prepackaged plugin upgrade (#13076) * MM-20065: allow prepackaged plugin upgrade When locally installing prepackaged plugins, skip if a plugin exists with the same id and is the same or a newer version. This is effectively a "poor man's" rework of prepackaged plugins to allow upgrade of prepackaged plugins via the marketplace. The larger plan to rework prepackaged plugins was deferred from v5.18. Fixes: https://mattermost.atlassian.net/browse/MM-20065 * eliminate unnecessary installPlugin * fix TestPluginSync defaults to match minio * cleanExistingBundles * close prepackaged filereader * simplify
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4d1c6cd446
Коммит
2571d97723
@@ -164,10 +164,18 @@ func (a *App) InitPlugins(pluginDir, webappPluginDir string) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if fileReader, err := os.Open(walkPath); err != nil {
|
||||
fileReader, err := os.Open(walkPath)
|
||||
if err != nil {
|
||||
mlog.Error("Failed to open prepackaged plugin", mlog.Err(err), mlog.String("path", walkPath))
|
||||
} else if _, err := a.installPluginLocally(fileReader, true); err != nil {
|
||||
mlog.Error("Failed to unpack prepackaged plugin", mlog.Err(err), mlog.String("path", walkPath))
|
||||
return nil
|
||||
}
|
||||
defer fileReader.Close()
|
||||
|
||||
mlog.Debug("Installing prepackaged plugin", mlog.String("path", walkPath))
|
||||
|
||||
_, appErr := a.installPluginLocally(fileReader, installPluginLocallyOnlyIfNewOrUpgrade)
|
||||
if appErr != nil {
|
||||
mlog.Error("Failed to unpack prepackaged plugin", mlog.Err(appErr), mlog.String("path", walkPath))
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -250,7 +258,7 @@ func (a *App) SyncPlugins() *model.AppError {
|
||||
defer reader.Close()
|
||||
|
||||
mlog.Info("Syncing plugin from file store", mlog.String("bundle", path))
|
||||
if _, err := a.installPluginLocally(reader, true); err != nil {
|
||||
if _, err := a.installPluginLocally(reader, installPluginLocallyAlways); err != nil {
|
||||
mlog.Error("Failed to sync plugin from file store", mlog.String("bundle", path), mlog.Err(err))
|
||||
}
|
||||
}
|
||||
@@ -364,7 +372,7 @@ func (a *App) DisablePlugin(id string) *model.AppError {
|
||||
}
|
||||
|
||||
if manifest == nil {
|
||||
return model.NewAppError("DisablePlugin", "app.plugin.not_installed.app_error", nil, "", http.StatusBadRequest)
|
||||
return model.NewAppError("DisablePlugin", "app.plugin.not_installed.app_error", nil, "", http.StatusNotFound)
|
||||
}
|
||||
|
||||
a.UpdateConfig(func(cfg *model.Config) {
|
||||
|
||||
Ссылка в новой задаче
Block a user