mirror of
https://github.com/grafana/grafana.git
synced 2024-12-26 17:01:09 -06:00
Plugins: Remove pre-existing plugin installs when installing with grafana-cli (#31515)
* remove old install before install if exists * fix log format
This commit is contained in:
parent
a55a272276
commit
c40d96d0ab
@ -230,6 +230,16 @@ func extractFiles(archiveFile string, pluginName string, dstDir string, allowSym
|
||||
}
|
||||
logger.Debugf("Extracting archive %q to %q...\n", archiveFile, dstDir)
|
||||
|
||||
existingInstallDir := filepath.Join(dstDir, pluginName)
|
||||
if _, err := os.Stat(existingInstallDir); !os.IsNotExist(err) {
|
||||
err = os.RemoveAll(existingInstallDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Infof("Removed existing installation of %s\n\n", pluginName)
|
||||
}
|
||||
|
||||
r, err := zip.OpenReader(archiveFile)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user