Skip to content

Commit

Permalink
fix(release_server): handle the case when requested values is empty (h…
Browse files Browse the repository at this point in the history
…elm#4604)

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Signed-off-by: Sebastien Plisson <sebastien.plisson@gmail.com>
  • Loading branch information
Matthew Fisher authored and splisson committed Dec 6, 2018
1 parent 9307aa4 commit 95cb34c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion pkg/tiller/release_server.go
Expand Up @@ -139,7 +139,11 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current

// merge new values with current
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}

Expand Down
5 changes: 2 additions & 3 deletions pkg/tiller/release_update_test.go
Expand Up @@ -159,12 +159,11 @@ func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) {
{Name: "templates/hello", Data: []byte("hello: world")},
},
},
Values: &chart.Config{Raw: ""},
Values: &chart.Config{Raw: "{}\n"},
ReuseValues: true,
}

_, err = rs.UpdateRelease(c, req)
if err != nil {
if _, err := rs.UpdateRelease(c, req); err != nil {
t.Fatalf("Failed updated: %s", err)
}
}
Expand Down

0 comments on commit 95cb34c

Please sign in to comment.