Added omitempty to Requirements struct

This was needed to get correct sha for requirements.yaml and requirements.lock
Fixes https://github.com/kubernetes/helm/issues/2598
pull/2605/head
Sushil Kumar 8 years ago
parent 012cb0ac1a
commit bfd74c35e9

@ -57,16 +57,16 @@ type Dependency struct {
// used to fetch the repository index. // used to fetch the repository index.
Repository string `json:"repository"` Repository string `json:"repository"`
// A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled ) // A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )
Condition string `json:"condition"` Condition string `json:"condition,omitempty"`
// Tags can be used to group charts for enabling/disabling together // Tags can be used to group charts for enabling/disabling together
Tags []string `json:"tags"` Tags []string `json:"tags,omitempty"`
// Enabled bool determines if chart should be loaded // Enabled bool determines if chart should be loaded
Enabled bool `json:"enabled"` Enabled bool `json:"enabled,omitempty"`
// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a // ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
// string or pair of child/parent sublist items. // string or pair of child/parent sublist items.
ImportValues []interface{} `json:"import-values"` ImportValues []interface{} `json:"import-values,omitempty"`
// Alias usable alias to be used for the chart // Alias usable alias to be used for the chart
Alias string `json:"alias"` Alias string `json:"alias,omitempty"`
} }
// ErrNoRequirementsFile to detect error condition // ErrNoRequirementsFile to detect error condition

@ -146,7 +146,7 @@ func TestResolve(t *testing.T) {
} }
func TestHashReq(t *testing.T) { func TestHashReq(t *testing.T) {
expect := "sha256:45b06fcc4496c705bf3d634f8a2ff84e6a6f0bdcaf010614b8886572d1e52b99" expect := "sha256:e70e41f8922e19558a8bf62f591a8b70c8e4622e3c03e5415f09aba881f13885"
req := &chartutil.Requirements{ req := &chartutil.Requirements{
Dependencies: []*chartutil.Dependency{ Dependencies: []*chartutil.Dependency{
{Name: "alpine", Version: "0.1.0", Repository: "http://localhost:8879/charts"}, {Name: "alpine", Version: "0.1.0", Repository: "http://localhost:8879/charts"},

Loading…
Cancel
Save