Skip to content

Commit b64a950

Browse files
committed
bundle: align genie_space generate with new dstate.DB Open signature
The state DB API gained context, withRecovery and withWrite arguments on origin/main; mirror the dashboard generate command and use the same arguments. Also regenerates the simple acceptance plan output to pick up the WAL-implementation serial increment. Co-authored-by: Isaac
1 parent 273cb87 commit b64a950

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

acceptance/bundle/resources/genie_spaces/simple/out.plan.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"plan_version": 2,
33
"cli_version": "[DEV_VERSION]",
44
"lineage": "[UUID]",
5-
"serial": 6,
5+
"serial": 7,
66
"plan": {
77
"resources.genie_spaces.sales_analytics": {
88
"action": "skip",

cmd/bundle/generate/genie_space.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"time"
1515

1616
"github.com/databricks/cli/bundle"
17+
"github.com/databricks/cli/bundle/deploy/terraform"
18+
"github.com/databricks/cli/bundle/direct/dstate"
1719
"github.com/databricks/cli/bundle/generate"
1820
"github.com/databricks/cli/bundle/phases"
1921
"github.com/databricks/cli/bundle/resources"
@@ -358,16 +360,25 @@ func (g *genieSpace) runForResource(ctx context.Context, b *bundle.Bundle) {
358360
return
359361
}
360362

363+
var state statemgmt.ExportedResourcesMap
361364
if stateDesc.Engine.IsDirect() {
362365
_, localPath := b.StateFilenameDirect(ctx)
363-
if err := b.DeploymentBundle.StateDB.Open(localPath); err != nil {
366+
if err := b.DeploymentBundle.StateDB.Open(ctx, localPath, dstate.WithRecovery(true), dstate.WithWrite(false)); err != nil {
367+
logdiag.LogError(ctx, err)
368+
return
369+
}
370+
state = b.DeploymentBundle.ExportState(ctx)
371+
} else {
372+
var err error
373+
state, err = terraform.ParseResourcesState(ctx, b)
374+
if err != nil {
364375
logdiag.LogError(ctx, err)
365376
return
366377
}
367378
}
368379

369380
bundle.ApplySeqContext(ctx, b,
370-
statemgmt.Load(stateDesc.Engine),
381+
statemgmt.Load(state),
371382
)
372383
if logdiag.HasError(ctx) {
373384
return

0 commit comments

Comments
 (0)