Plugins: Tidy up CLI code (#67723)

* remove dead code and use pkg/plugins for uninstall process

* fix linter

* remove unnecessary cruft
This commit is contained in:
Will Browne
2023-05-04 10:52:09 +02:00
committed by GitHub
parent 3644ea6556
commit fd28c8490f
11 changed files with 25 additions and 74 deletions
@@ -1,36 +0,0 @@
package commandstest
import (
"os"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
)
type FakeGrafanaComClient struct {
GetPluginFunc func(pluginId, repoUrl string) (models.Plugin, error)
DownloadFileFunc func(pluginName string, tmpFile *os.File, url string, checksum string) (err error)
ListAllPluginsFunc func(repoUrl string) (models.PluginRepo, error)
}
func (client *FakeGrafanaComClient) GetPlugin(pluginID, repoUrl string) (models.Plugin, error) {
if client.GetPluginFunc != nil {
return client.GetPluginFunc(pluginID, repoUrl)
}
return models.Plugin{}, nil
}
func (client *FakeGrafanaComClient) DownloadFile(pluginName string, tmpFile *os.File, url string, checksum string) (err error) {
if client.DownloadFileFunc != nil {
return client.DownloadFileFunc(pluginName, tmpFile, url, checksum)
}
return nil
}
func (client *FakeGrafanaComClient) ListAllPlugins(repoURL string) (models.PluginRepo, error) {
if client.ListAllPluginsFunc != nil {
return client.ListAllPluginsFunc(repoURL)
}
return models.PluginRepo{}, nil
}