Merge pull request #10834 from stan-sz/stan-sz/10285

Log error message on failed download
pull/11233/head
Martin Hickey 2 years ago committed by GitHub
commit f08db5c899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,14 +47,14 @@ func TestShowPreReleaseChart(t *testing.T) {
name: "show pre-release chart",
args: "test/pre-release-chart",
fail: true,
expectedErr: "failed to download \"test/pre-release-chart\"",
expectedErr: "chart \"pre-release-chart\" matching not found in test index. (try 'helm repo update'): no chart version found for pre-release-chart-",
},
{
name: "show pre-release chart",
args: "test/pre-release-chart",
fail: true,
flags: "--version 1.0.0",
expectedErr: "failed to download \"test/pre-release-chart\" at version \"1.0.0\"",
expectedErr: "chart \"pre-release-chart\" matching 1.0.0 not found in test index. (try 'helm repo update'): no chart version found for pre-release-chart-1.0.0",
},
{
name: "show pre-release chart with 'devel' flag",

@ -755,20 +755,13 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
}
filename, _, err := dl.DownloadTo(name, version, settings.RepositoryCache)
if err == nil {
lname, err := filepath.Abs(filename)
if err != nil {
return filename, err
}
return lname, nil
} else if settings.Debug {
return filename, err
if err != nil {
return "", err
}
atVersion := ""
if version != "" {
atVersion = fmt.Sprintf(" at version %q", version)
lname, err := filepath.Abs(filename)
if err != nil {
return filename, err
}
return filename, errors.Errorf("failed to download %q%s", name, atVersion)
return lname, nil
}

Loading…
Cancel
Save