Commit 5a217423 authored by Matt Butcher's avatar Matt Butcher

fix(helm): fix repo package to use chartutil

parent 377a4338
......@@ -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
......
......@@ -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) {
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment