diff --git a/pkg/repo/index.go b/pkg/repo/index.go index f1467c633..1271688c0 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -7,7 +7,7 @@ import ( "gopkg.in/yaml.v2" - "k8s.io/helm/pkg/chart" + "k8s.io/helm/pkg/proto/hapi/chart" ) var indexPath = "index.yaml" @@ -24,7 +24,7 @@ type ChartRef struct { Created string `yaml:"created,omitempty"` Removed bool `yaml:"removed,omitempty"` Checksum string `yaml:"checksum,omitempty"` - Chartfile chart.Chartfile `yaml:"chartfile"` + Chartfile *chart.Metadata `yaml:"chartfile"` } // DownloadIndexFile uses diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go index e891c8690..168f4bfa1 100644 --- a/pkg/repo/index_test.go +++ b/pkg/repo/index_test.go @@ -29,7 +29,12 @@ func TestDownloadIndexFile(t *testing.T) { fmt.Fprintln(w, string(fileBytes)) })) - dirName, err := ioutil.TempDir("testdata", "tmp") + dirName, err := ioutil.TempDir("", "tmp") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dirName) + path := filepath.Join(dirName, testRepo+"-index.yaml") if err := DownloadIndexFile(testRepo, ts.URL, path); err != nil { t.Errorf("%#v", err) @@ -54,8 +59,6 @@ func TestDownloadIndexFile(t *testing.T) { t.Errorf("Expected 2 entries in index file but got %v", numEntries) } os.Remove(path) - os.Remove(dirName) - } func TestLoadIndexFile(t *testing.T) { diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index 290f069cc..3c6dc842e 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -13,7 +13,7 @@ import ( "gopkg.in/yaml.v2" - "k8s.io/helm/pkg/chart" + "k8s.io/helm/pkg/chartutil" ) // ChartRepository represents a chart repository @@ -108,12 +108,12 @@ func (r *ChartRepository) Index() error { } for _, path := range r.ChartPaths { - ch, err := chart.Load(path) + ch, err := chartutil.Load(path) if err != nil { return err } - chartfile := ch.Chartfile() + chartfile := ch.Metadata hash, err := generateChecksum(path) if err != nil { return err @@ -135,7 +135,7 @@ func (r *ChartRepository) Index() error { url, _ := url.Parse(r.URL) url.Path = filepath.Join(url.Path, key+".tgz") - entry := &ChartRef{Chartfile: *chartfile, Name: chartfile.Name, URL: url.String(), Created: created, Checksum: hash, Removed: false} + entry := &ChartRef{Chartfile: chartfile, Name: chartfile.Name, URL: url.String(), Created: created, Checksum: hash, Removed: false} r.IndexFile.Entries[key] = entry diff --git a/pkg/repo/testdata/repository/frobnitz-1.2.3.tgz b/pkg/repo/testdata/repository/frobnitz-1.2.3.tgz index 0fe27e994..fc8cacec2 100644 Binary files a/pkg/repo/testdata/repository/frobnitz-1.2.3.tgz and b/pkg/repo/testdata/repository/frobnitz-1.2.3.tgz differ diff --git a/pkg/repo/testdata/repository/sprocket-1.2.0.tgz b/pkg/repo/testdata/repository/sprocket-1.2.0.tgz index 55192ce20..82188a99b 100644 Binary files a/pkg/repo/testdata/repository/sprocket-1.2.0.tgz and b/pkg/repo/testdata/repository/sprocket-1.2.0.tgz differ