diff --git a/cmd/helm/search.go b/cmd/helm/search.go index 579773413..4254900fc 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -32,7 +32,6 @@ func search(cmd *cobra.Command, args []string) error { return err } if len(results) > 0 { - cmd.Println("Charts:") for _, result := range results { fmt.Println(result) } @@ -68,11 +67,19 @@ func searchCacheForPattern(dir string, search string) ([]string, error) { }) matches := []string{} for _, f := range fileList { - index, _ := repo.LoadIndexFile(f) + index, err := repo.LoadIndexFile(f) + if err != nil { + return matches, fmt.Errorf("index %s corrupted: %s", f, err) + } + m := searchChartRefsForPattern(search, index.Entries) repoName := strings.TrimSuffix(filepath.Base(f), "-index.yaml") for _, c := range m { - matches = append(matches, repoName+"/"+c) + // TODO: Is it possible for this file to be missing? Or to have + // an extension other than .tgz? Should the actual filename be in + // the YAML? + fname := filepath.Join(repoName, c+".tgz") + matches = append(matches, fname) } } return matches, nil diff --git a/cmd/helm/search_test.go b/cmd/helm/search_test.go index 7001cdec3..87d65afc2 100644 --- a/cmd/helm/search_test.go +++ b/cmd/helm/search_test.go @@ -23,10 +23,10 @@ var searchTestCases = []searchTestCase{ var searchCacheTestCases = []searchTestCase{ {"notthere", []string{}}, - {"odd", []string{"foobar/oddness-1.2.3"}}, - {"sumtin", []string{"local/alpine-1.0.0", "foobar/oddness-1.2.3"}}, - {"foobar", []string{"foobar/foobar-0.1.0"}}, - {"web", []string{"local/nginx-0.1.0"}}, + {"odd", []string{"foobar/oddness-1.2.3.tgz"}}, + {"sumtin", []string{"local/alpine-1.0.0.tgz", "foobar/oddness-1.2.3.tgz"}}, + {"foobar", []string{"foobar/foobar-0.1.0.tgz"}}, + {"web", []string{"local/nginx-0.1.0.tgz"}}, } func validateEntries(t *testing.T, in string, found []string, expected []string) {