From bfd74c35e98dc99dc0ee9c300145f193878b43cc Mon Sep 17 00:00:00 2001 From: Sushil Kumar Date: Wed, 21 Jun 2017 11:17:05 -0700 Subject: [PATCH] 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 --- pkg/chartutil/requirements.go | 10 +++++----- pkg/resolver/resolver_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index fbd686b91..ee7d95238 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -57,16 +57,16 @@ type Dependency struct { // used to fetch the repository index. Repository string `json:"repository"` // 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 []string `json:"tags"` + Tags []string `json:"tags,omitempty"` // 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 // 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 string `json:"alias"` + Alias string `json:"alias,omitempty"` } // ErrNoRequirementsFile to detect error condition diff --git a/pkg/resolver/resolver_test.go b/pkg/resolver/resolver_test.go index b87022b93..78a0bc46c 100644 --- a/pkg/resolver/resolver_test.go +++ b/pkg/resolver/resolver_test.go @@ -146,7 +146,7 @@ func TestResolve(t *testing.T) { } func TestHashReq(t *testing.T) { - expect := "sha256:45b06fcc4496c705bf3d634f8a2ff84e6a6f0bdcaf010614b8886572d1e52b99" + expect := "sha256:e70e41f8922e19558a8bf62f591a8b70c8e4622e3c03e5415f09aba881f13885" req := &chartutil.Requirements{ Dependencies: []*chartutil.Dependency{ {Name: "alpine", Version: "0.1.0", Repository: "http://localhost:8879/charts"},