Plugins: Remove dead CLI code and use pkg/plugins for uninstall process (#67711)

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

* fix linter
This commit is contained in:
Will Browne
2023-05-03 14:52:57 +02:00
committed by GitHub
parent 471a03328b
commit 6cd042ed16
8 changed files with 42 additions and 125 deletions
+4 -10
View File
@@ -1,31 +1,25 @@
package commands
import (
"context"
"errors"
"fmt"
"strings"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
)
var removePlugin func(pluginPath, id string) error = services.RemoveInstalledPlugin
func (cmd Command) removeCommand(c utils.CommandLine) error {
pluginPath := c.PluginDirectory()
plugin := c.Args().First()
if plugin == "" {
pluginID := c.Args().First()
if pluginID == "" {
return errors.New("missing plugin parameter")
}
err := removePlugin(pluginPath, plugin)
err := uninstallPlugin(context.Background(), pluginID, c)
if err != nil {
if strings.Contains(err.Error(), "no such file or directory") {
return fmt.Errorf("plugin does not exist")
}
return err
} else {
logRestartNotice()