Skip to content

Commit

Permalink
Plugins: display plugin id and url when it fails to install (#67336)
Browse files Browse the repository at this point in the history
* display plugin id and url when it fails to install
* Update pkg/plugins/repo/client.go
Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
  • Loading branch information
briangann authored May 10, 2023
1 parent acd02e8 commit 8cd4866
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/plugins/repo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Client) download(_ context.Context, pluginZipURL, checksum string, comp
if err := tmpFile.Close(); err != nil {
c.log.Warn("Failed to close file", "err", err)
}
return nil, fmt.Errorf("%v: %w", "failed to download plugin archive", err)
return nil, fmt.Errorf("%w: failed to download plugin archive (%s)", err, pluginZipURL)
}

rc, err := zip.OpenReader(tmpFile.Name())
Expand Down Expand Up @@ -143,7 +143,7 @@ func (c *Client) downloadFile(tmpFile *os.File, pluginURL, checksum string, comp
return fmt.Errorf("failed to write to %q: %w", tmpFile.Name(), err)
}
if len(checksum) > 0 && checksum != fmt.Sprintf("%x", h.Sum(nil)) {
return fmt.Errorf("expected SHA256 checksum does not match the downloaded archive - please contact security@grafana.com")
return fmt.Errorf("expected SHA256 checksum does not match the downloaded archive (%s) - please contact security@grafana.com", pluginURL)
}
return nil
}
Expand Down

0 comments on commit 8cd4866

Please sign in to comment.