Commit 455dd976 authored by Matt Butcher's avatar Matt Butcher Committed by GitHub

Merge pull request #2220 from jascott1/tags_fix

fix (pkg/chartutil): correctly parse input values for ProcessRequirem…
parents a8e09833 8c720ee2
......@@ -236,10 +236,15 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
if err != nil {
return err
}
// convert our values back into config
yvals, err := cvals.YAML()
if err != nil {
return err
}
cc := chart.Config{Raw: yvals}
// flag dependencies as enabled/disabled
ProcessRequirementsTags(reqs, cvals)
ProcessRequirementsConditions(reqs, cvals)
// make a map of charts to remove
rm := map[string]bool{}
for _, r := range reqs.Dependencies {
......@@ -259,7 +264,7 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
}
// recursively call self to process sub dependencies
for _, t := range cd {
err := ProcessRequirementsEnabled(t, v)
err := ProcessRequirementsEnabled(t, &cc)
// if its not just missing requirements file, return error
if nerr, ok := err.(ErrNoRequirementsFile); !ok && err != nil {
return nerr
......
......@@ -74,15 +74,16 @@ func TestRequirementsTagsEnabledL1(t *testing.T) {
verifyRequirementsEnabled(t, c, v, e)
}
func TestRequirementsTagsDisabledL2(t *testing.T) {
c, err := Load("testdata/subpop")
if err != nil {
t.Fatalf("Failed to load testdata: %s", err)
}
// tags disabling only children
// tags disabling only children, children still enabled since tag front-end=true in values.yaml
v := &chart.Config{Raw: "tags:\n subcharta: false\n\n subchartb: false\n"}
// expected charts including duplicates in alphanumeric order
e := []string{"parentchart", "subchart1"}
e := []string{"parentchart", "subchart1", "subcharta", "subchartb"}
verifyRequirementsEnabled(t, c, v, e)
}
......@@ -115,10 +116,10 @@ func TestRequirementsConditionsEnabledL1Both(t *testing.T) {
if err != nil {
t.Fatalf("Failed to load testdata: %s", err)
}
// conditions enabling the parent charts, effectively enabling children
// conditions enabling the parent charts, but back-end (b, c) is still disabled via values.yaml
v := &chart.Config{Raw: "subchart1:\n enabled: true\nsubchart2:\n enabled: true\n"}
// expected charts including duplicates in alphanumeric order
e := []string{"parentchart", "subchart1", "subchart2", "subcharta", "subchartb", "subchartb", "subchartc"}
e := []string{"parentchart", "subchart1", "subchart2", "subcharta", "subchartb"}
verifyRequirementsEnabled(t, c, v, e)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment