From 8e70e9c1c3aa5097b8071c7826a9ed11e99f4669 Mon Sep 17 00:00:00 2001 From: bergquist Date: Sun, 13 Mar 2016 11:29:43 +0100 Subject: [PATCH] feat(cli): improve error message for missing permission --- pkg/cmd/grafana-cli/commands/install_command.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go index 9b9faaa3fe4..cf10444a0fe 100644 --- a/pkg/cmd/grafana-cli/commands/install_command.go +++ b/pkg/cmd/grafana-cli/commands/install_command.go @@ -14,6 +14,7 @@ import ( "os" "path" "regexp" + "strings" ) func validateInput(c CommandLine, pluginFolder string) error { @@ -160,7 +161,11 @@ func downloadFile(pluginName, filePath, url string) (err error) { } else { dst, err := os.Create(newFile) if err != nil { - log.Errorf("%v", err) + if strings.Contains(err.Error(), "permission denied") { + return fmt.Errorf( + "Could not create file %s. permission deined. Make sure you have write access to plugindir", + newFile) + } } defer dst.Close() src, err := zf.Open()