fix(helm): helm repo index should not delete entry, instead it should update removed=true

pull/947/head
ngtuna 9 years ago
parent 578ba71b10
commit bfce033cc0

@ -105,7 +105,6 @@ func LoadChartRepository(dir, url string) (*ChartRepository, error) {
} }
return nil return nil
}) })
return r, nil return r, nil
} }
@ -124,6 +123,8 @@ func (r *ChartRepository) Index() error {
r.IndexFile = &IndexFile{Entries: make(map[string]*ChartRef)} r.IndexFile = &IndexFile{Entries: make(map[string]*ChartRef)}
} }
var existCharts map[string]bool = make(map[string]bool)
for _, path := range r.ChartPaths { for _, path := range r.ChartPaths {
ch, err := chartutil.Load(path) ch, err := chartutil.Load(path)
if err != nil { if err != nil {
@ -156,6 +157,15 @@ func (r *ChartRepository) Index() error {
r.IndexFile.Entries[key] = entry r.IndexFile.Entries[key] = entry
// chart is existing
existCharts[key] = true
}
// update deleted charts with Removed = true
for k, _ := range r.IndexFile.Entries {
if _, ok := existCharts[k]; !ok {
r.IndexFile.Entries[k].Removed = true
}
} }
return r.saveIndexFile() return r.saveIndexFile()

Loading…
Cancel
Save