Automatic Merge
Этот коммит содержится в:
@@ -31,7 +31,7 @@ import (
|
||||
const prepackagedPluginsDir = "prepackaged_plugins"
|
||||
|
||||
type pluginSignaturePath struct {
|
||||
pluginId string
|
||||
pluginID string
|
||||
path string
|
||||
signaturePath string
|
||||
}
|
||||
@@ -91,9 +91,9 @@ func (a *App) SyncPluginsActiveState() {
|
||||
disabledPlugins := []*model.BundleInfo{}
|
||||
enabledPlugins := []*model.BundleInfo{}
|
||||
for _, plugin := range availablePlugins {
|
||||
pluginId := plugin.Manifest.Id
|
||||
pluginID := plugin.Manifest.Id
|
||||
pluginEnabled := false
|
||||
if state, ok := config.PluginStates[pluginId]; ok {
|
||||
if state, ok := config.PluginStates[pluginID]; ok {
|
||||
pluginEnabled = state.Enable
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ func (a *App) SyncPluginsActiveState() {
|
||||
go func(plugin *model.BundleInfo) {
|
||||
defer wg.Done()
|
||||
|
||||
pluginId := plugin.Manifest.Id
|
||||
updatedManifest, activated, err := pluginsEnvironment.Activate(pluginId)
|
||||
pluginID := plugin.Manifest.Id
|
||||
updatedManifest, activated, err := pluginsEnvironment.Activate(pluginID)
|
||||
if err != nil {
|
||||
plugin.WrapLogger(a.Log()).Error("Unable to activate plugin", mlog.Err(err))
|
||||
return
|
||||
@@ -494,7 +494,7 @@ func (a *App) GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*m
|
||||
}
|
||||
|
||||
// getPrepackagedPlugin returns a pre-packaged plugin.
|
||||
func (a *App) getPrepackagedPlugin(pluginId, version string) (*plugin.PrepackagedPlugin, *model.AppError) {
|
||||
func (a *App) getPrepackagedPlugin(pluginID, version string) (*plugin.PrepackagedPlugin, *model.AppError) {
|
||||
pluginsEnvironment := a.GetPluginsEnvironment()
|
||||
if pluginsEnvironment == nil {
|
||||
return nil, model.NewAppError("getPrepackagedPlugin", "app.plugin.config.app_error", nil, "plugin environment is nil", http.StatusInternalServerError)
|
||||
@@ -502,7 +502,7 @@ func (a *App) getPrepackagedPlugin(pluginId, version string) (*plugin.Prepackage
|
||||
|
||||
prepackagedPlugins := pluginsEnvironment.PrepackagedPlugins()
|
||||
for _, p := range prepackagedPlugins {
|
||||
if p.Manifest.Id == pluginId && p.Manifest.Version == version {
|
||||
if p.Manifest.Id == pluginID && p.Manifest.Version == version {
|
||||
return p, nil
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ func (a *App) getPrepackagedPlugin(pluginId, version string) (*plugin.Prepackage
|
||||
}
|
||||
|
||||
// getRemoteMarketplacePlugin returns plugin from marketplace-server.
|
||||
func (a *App) getRemoteMarketplacePlugin(pluginId, version string) (*model.BaseMarketplacePlugin, *model.AppError) {
|
||||
func (a *App) getRemoteMarketplacePlugin(pluginID, version string) (*model.BaseMarketplacePlugin, *model.AppError) {
|
||||
marketplaceClient, err := marketplace.NewClient(
|
||||
*a.Config().PluginSettings.MarketplaceUrl,
|
||||
a.HTTPService(),
|
||||
@@ -521,7 +521,7 @@ func (a *App) getRemoteMarketplacePlugin(pluginId, version string) (*model.BaseM
|
||||
}
|
||||
|
||||
filter := a.getBaseMarketplaceFilter()
|
||||
filter.PluginId = pluginId
|
||||
filter.PluginId = pluginID
|
||||
filter.ReturnAllVersions = true
|
||||
|
||||
plugin, err := marketplaceClient.GetPlugin(filter, version)
|
||||
@@ -791,7 +791,7 @@ func (a *App) getPluginsFromFilePaths(fileStorePaths []string) map[string]*plugi
|
||||
if strings.HasSuffix(path, ".tar.gz") {
|
||||
id := strings.TrimSuffix(filepath.Base(path), ".tar.gz")
|
||||
helper := &pluginSignaturePath{
|
||||
pluginId: id,
|
||||
pluginID: id,
|
||||
path: path,
|
||||
signaturePath: "",
|
||||
}
|
||||
@@ -907,16 +907,16 @@ func (a *App) installFeatureFlagPlugins() {
|
||||
return
|
||||
}
|
||||
|
||||
for pluginId, version := range ffControledPlugins {
|
||||
for pluginID, version := range ffControledPlugins {
|
||||
// Skip installing if the plugin has been previously disabled.
|
||||
pluginState := a.Config().PluginSettings.PluginStates[pluginId]
|
||||
pluginState := a.Config().PluginSettings.PluginStates[pluginID]
|
||||
if pluginState != nil && !pluginState.Enable {
|
||||
a.Log().Debug("Not auto installing/upgrade because plugin was disabled", mlog.String("plugin_id", pluginId), mlog.String("version", version))
|
||||
a.Log().Debug("Not auto installing/upgrade because plugin was disabled", mlog.String("plugin_id", pluginID), mlog.String("version", version))
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if we already installed this version as InstallMarketplacePlugin can't handle re-installs well.
|
||||
pluginStatus, err := a.Srv().GetPluginStatus(pluginId)
|
||||
pluginStatus, err := a.Srv().GetPluginStatus(pluginID)
|
||||
pluginExists := err == nil
|
||||
if pluginExists && pluginStatus.Version == version {
|
||||
continue
|
||||
@@ -929,32 +929,32 @@ func (a *App) installFeatureFlagPlugins() {
|
||||
if !inCloud && pluginExists {
|
||||
parsedVersion, err := semver.Parse(version)
|
||||
if err != nil {
|
||||
a.Log().Debug("Bad version from feature flag", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version))
|
||||
a.Log().Debug("Bad version from feature flag", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", version))
|
||||
return
|
||||
}
|
||||
parsedExistingVersion, err := semver.Parse(pluginStatus.Version)
|
||||
if err != nil {
|
||||
a.Log().Debug("Bad version from plugin manifest", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", pluginStatus.Version))
|
||||
a.Log().Debug("Bad version from plugin manifest", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", pluginStatus.Version))
|
||||
return
|
||||
}
|
||||
|
||||
if parsedVersion.LTE(parsedExistingVersion) {
|
||||
a.Log().Debug("Skip installation because given version was a downgrade and on-prem installations should not downgrade.", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", pluginStatus.Version))
|
||||
a.Log().Debug("Skip installation because given version was a downgrade and on-prem installations should not downgrade.", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", pluginStatus.Version))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
_, err := a.InstallMarketplacePlugin(&model.InstallMarketplacePluginRequest{
|
||||
Id: pluginId,
|
||||
Id: pluginID,
|
||||
Version: version,
|
||||
})
|
||||
if err != nil {
|
||||
a.Log().Debug("Unable to install plugin from FF manifest", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version))
|
||||
a.Log().Debug("Unable to install plugin from FF manifest", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", version))
|
||||
} else {
|
||||
if err := a.EnablePlugin(pluginId); err != nil {
|
||||
a.Log().Debug("Unable to enable plugin installed from feature flag.", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version))
|
||||
if err := a.EnablePlugin(pluginID); err != nil {
|
||||
a.Log().Debug("Unable to enable plugin installed from feature flag.", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", version))
|
||||
} else {
|
||||
a.Log().Debug("Installed and enabled plugin.", mlog.String("plugin_id", pluginId), mlog.String("version", version))
|
||||
a.Log().Debug("Installed and enabled plugin.", mlog.String("plugin_id", pluginID), mlog.String("version", version))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user