Merge pull request #7383 from VilledeMontreal/feat/rmDeadCode

feat(chore): Remove unused code
pull/7405/head
Marc Khouzam 5 years ago committed by GitHub
commit 72edf56150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,8 +17,6 @@ limitations under the License.
package repo
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path"
@ -290,48 +288,3 @@ func loadIndex(data []byte) (*IndexFile, error) {
}
return i, nil
}
// unversionedEntry represents a deprecated pre-Alpha.5 format.
//
// This will be removed prior to v2.0.0
type unversionedEntry struct {
Checksum string `json:"checksum"`
URL string `json:"url"`
Chartfile *chart.Metadata `json:"chartfile"`
}
// loadUnversionedIndex loads a pre-Alpha.5 index.yaml file.
//
// This format is deprecated. This function will be removed prior to v2.0.0.
func loadUnversionedIndex(data []byte) (*IndexFile, error) {
fmt.Fprintln(os.Stderr, "WARNING: Deprecated index file format. Try 'helm repo update'")
i := map[string]unversionedEntry{}
// This gets around an error in the YAML parser. Instead of parsing as YAML,
// we convert to JSON, and then decode again.
var err error
data, err = yaml.YAMLToJSON(data)
if err != nil {
return nil, err
}
if err := json.Unmarshal(data, &i); err != nil {
return nil, err
}
if len(i) == 0 {
return nil, ErrNoAPIVersion
}
ni := NewIndexFile()
for n, item := range i {
if item.Chartfile == nil || item.Chartfile.Name == "" {
parts := strings.Split(n, "-")
ver := ""
if len(parts) > 1 {
ver = strings.TrimSuffix(parts[1], ".tgz")
}
item.Chartfile = &chart.Metadata{Name: parts[0], Version: ver}
}
ni.Add(item.Chartfile, item.URL, "", item.Checksum)
}
return ni, nil
}

@ -361,26 +361,6 @@ func TestIndexDirectory(t *testing.T) {
}
}
func TestLoadUnversionedIndex(t *testing.T) {
data, err := ioutil.ReadFile("testdata/unversioned-index.yaml")
if err != nil {
t.Fatal(err)
}
ind, err := loadUnversionedIndex(data)
if err != nil {
t.Fatal(err)
}
if l := len(ind.Entries); l != 2 {
t.Fatalf("Expected 2 entries, got %d", l)
}
if l := len(ind.Entries["mysql"]); l != 3 {
t.Fatalf("Expected 3 mysql versions, got %d", l)
}
}
func TestIndexAdd(t *testing.T) {
i := NewIndexFile()
i.Add(&chart.Metadata{Name: "clipper", Version: "0.1.0"}, "clipper-0.1.0.tgz", "http://example.com/charts", "sha256:1234567890")

@ -1,60 +0,0 @@
memcached-0.1.0:
name: memcached
url: https://mumoshu.github.io/charts/memcached-0.1.0.tgz
created: 2016-08-04 02:05:02.259205055 +0000 UTC
checksum: ce9b76576c4b4eb74286fa30a978c56d69e7a522
chartfile:
name: memcached
home: http://https://hub.docker.com/_/memcached/
sources: []
version: 0.1.0
description: A simple Memcached cluster
keywords: []
maintainers:
- name: Matt Butcher
email: mbutcher@deis.com
mysql-0.2.0:
name: mysql
url: https://mumoshu.github.io/charts/mysql-0.2.0.tgz
created: 2016-08-04 00:42:47.517342022 +0000 UTC
checksum: aa5edd2904d639b0b6295f1c7cf4c0a8e4f77dd3
chartfile:
name: mysql
home: https://www.mysql.com/
sources: []
version: 0.2.0
description: Chart running MySQL.
keywords: []
maintainers:
- name: Matt Fisher
email: mfisher@deis.com
mysql-0.2.1:
name: mysql
url: https://mumoshu.github.io/charts/mysql-0.2.1.tgz
created: 2016-08-04 02:40:29.717829534 +0000 UTC
checksum: 9d9f056171beefaaa04db75680319ca4edb6336a
chartfile:
name: mysql
home: https://www.mysql.com/
sources: []
version: 0.2.1
description: Chart running MySQL.
keywords: []
maintainers:
- name: Matt Fisher
email: mfisher@deis.com
mysql-0.2.2:
name: mysql
url: https://mumoshu.github.io/charts/mysql-0.2.2.tgz
created: 2016-08-04 02:40:29.71841952 +0000 UTC
checksum: 6d6810e76a5987943faf0040ec22990d9fb141c7
chartfile:
name: mysql
home: https://www.mysql.com/
sources: []
version: 0.2.2
description: Chart running MySQL.
keywords: []
maintainers:
- name: Matt Fisher
email: mfisher@deis.com
Loading…
Cancel
Save