mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
feat(chore): Remove unused code
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This commit is contained in:
parent
edaac9649e
commit
d3a8cc4713
3 changed files with 0 additions and 127 deletions
|
|
@ -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")
|
||||
|
|
|
|||
60
pkg/repo/testdata/unversioned-index.yaml
vendored
60
pkg/repo/testdata/unversioned-index.yaml
vendored
|
|
@ -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…
Reference in a new issue