From a51e789599552dcd33da5651687a0297959b7d4e Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Tue, 16 Apr 2024 12:13:10 +0200 Subject: [PATCH] Force send local_ssd_count field even if it's set to zero --- bundle/config/resources/job.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bundle/config/resources/job.go b/bundle/config/resources/job.go index 45e9662d..38962741 100644 --- a/bundle/config/resources/job.go +++ b/bundle/config/resources/job.go @@ -5,6 +5,7 @@ import ( "strconv" "github.com/databricks/cli/bundle/config/paths" + "github.com/databricks/cli/libs/dyn" "github.com/databricks/cli/libs/log" "github.com/databricks/databricks-sdk-go" "github.com/databricks/databricks-sdk-go/marshal" @@ -26,6 +27,20 @@ func (s *Job) UnmarshalJSON(b []byte) error { } func (s Job) MarshalJSON() ([]byte, error) { + // If local_ssd_count is set, we need to force send it + p := dyn.NewPattern( + dyn.Key("job_clusters"), + dyn.AnyIndex(), + dyn.Key("new_cluster"), + dyn.Key("gcp_attributes"), + dyn.Key("local_ssd_count"), + ) + + dyn.MapByPattern(s.DynamicValue, p, func(p dyn.Path, v dyn.Value) (dyn.Value, error) { + s.JobSettings.JobClusters[p[1].Index()].NewCluster.GcpAttributes.ForceSendFields = []string{"LocalSsdCount"} + return v, nil + }) + return marshal.Marshal(s) }