Unverified Commit 941b1f4d authored by Matthew Fisher's avatar Matthew Fisher Committed by GitHub

fix(release_server): handle the case when requested values is empty (#4604)

Signed-off-by: 's avatarMatthew Fisher <matt.fisher@microsoft.com>
parent 37a731db
...@@ -139,7 +139,11 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current ...@@ -139,7 +139,11 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current
// merge new values with current // merge new values with current
if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" { if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" {
req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw if req.Values.Raw != "{}\n" {
req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw
} else {
req.Values.Raw = current.Config.Raw + "\n"
}
} }
req.Chart.Values = &chart.Config{Raw: nv} req.Chart.Values = &chart.Config{Raw: nv}
......
...@@ -159,12 +159,11 @@ func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) { ...@@ -159,12 +159,11 @@ func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) {
{Name: "templates/hello", Data: []byte("hello: world")}, {Name: "templates/hello", Data: []byte("hello: world")},
}, },
}, },
Values: &chart.Config{Raw: ""}, Values: &chart.Config{Raw: "{}\n"},
ReuseValues: true, ReuseValues: true,
} }
_, err = rs.UpdateRelease(c, req) if _, err := rs.UpdateRelease(c, req); err != nil {
if err != nil {
t.Fatalf("Failed updated: %s", err) t.Fatalf("Failed updated: %s", err)
} }
} }
......
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