use new plugin-specific repo route when installing or updating a single plugin (#4992)

This commit is contained in:
Dan Cech
2016-05-12 10:43:31 +02:00
committed by Torkel Ödegaard
parent 2f6b00b6f7
commit 9f9f4e7fef
2 changed files with 22 additions and 15 deletions
@@ -1,6 +1,8 @@
package commands
import (
"github.com/fatih/color"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
s "github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
@@ -14,20 +16,17 @@ func upgradeCommand(c CommandLine) error {
return err
}
remotePlugins, err2 := s.ListAllPlugins(c.GlobalString("repo"))
v, err2 := s.GetPlugin(localPlugin.Id, c.GlobalString("repo"))
if err2 != nil {
return err2
}
for _, v := range remotePlugins.Plugins {
if localPlugin.Id == v.Id {
if ShouldUpgrade(localPlugin.Info.Version, v) {
s.RemoveInstalledPlugin(pluginsDir, pluginName)
return InstallPlugin(localPlugin.Id, "", c)
}
}
if ShouldUpgrade(localPlugin.Info.Version, v) {
s.RemoveInstalledPlugin(pluginsDir, pluginName)
return InstallPlugin(localPlugin.Id, "", c)
}
log.Infof("%s %s is up to date \n", color.GreenString("✔"), localPlugin.Id)
return nil
}