diff --git a/director/deployment.go b/director/deployment.go index 5cfdce080..657a69906 100644 --- a/director/deployment.go +++ b/director/deployment.go @@ -413,12 +413,8 @@ func (c Client) UpdateDeployment(manifest []byte, opts UpdateOpts) error { if len(opts.Diff.context) != 0 { context := map[string]interface{}{} - if opts.Diff.context["cloud_config_id"] != nil { - context["cloud_config_id"] = opts.Diff.context["cloud_config_id"] - } - - if opts.Diff.context["runtime_config_id"] != nil { - context["runtime_config_id"] = opts.Diff.context["runtime_config_id"] + for key, value := range opts.Diff.context { + context[key] = value } contextJson, err := json.Marshal(context) diff --git a/director/deployment_test.go b/director/deployment_test.go index 217e77341..5b349deae 100644 --- a/director/deployment_test.go +++ b/director/deployment_test.go @@ -655,13 +655,15 @@ var _ = Describe("Deployment", func() { It("succeeds updating deployment with diff context values", func() { context := map[string]interface{}{ - "cloud_config_id": "2", - "runtime_config_id": 4, + "cloud_config_id": "2", + "runtime_config_id": 4, + "some_other_context_field": "value", } + requestParams := "context=%7B%22cloud_config_id%22%3A%222%22%2C%22runtime_config_id%22%3A4%2C%22some_other_context_field%22%3A%22value%22%7D" ConfigureTaskResult( ghttp.CombineHandlers( - ghttp.VerifyRequest("POST", "/deployments", "context=%7B%22cloud_config_id%22%3A%222%22%2C%22runtime_config_id%22%3A4%7D"), + ghttp.VerifyRequest("POST", "/deployments", requestParams), ghttp.VerifyBasicAuth("username", "password"), ghttp.VerifyHeader(http.Header{ "Content-Type": []string{"text/yaml"},