mirror of https://github.com/databricks/cli.git
Add nil check
This commit is contained in:
parent
2dad625b84
commit
821239e45d
|
@ -158,6 +158,9 @@ func isRunAsSet(r config.Resources) bool {
|
|||
}
|
||||
|
||||
func isExplicitRootSet(b *bundle.Bundle) bool {
|
||||
if b.Config.Targets == nil {
|
||||
return false
|
||||
}
|
||||
targetConfig := b.Config.Targets[b.Config.Bundle.Target]
|
||||
if targetConfig.Workspace == nil {
|
||||
return false
|
||||
|
|
|
@ -32,10 +32,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle {
|
|||
Branch: "main",
|
||||
},
|
||||
},
|
||||
Targets: map[string]*config.Target{
|
||||
"": {},
|
||||
},
|
||||
Workspace: config.Workspace{
|
||||
Workspace: config.Workspace{
|
||||
CurrentUser: &config.User{
|
||||
ShortName: "lennart",
|
||||
User: &iam.User{
|
||||
|
@ -337,8 +334,12 @@ func TestProcessTargetModeProductionOkWithRootPath(t *testing.T) {
|
|||
require.Error(t, diags.Error())
|
||||
|
||||
// ... but we're okay if we specify a root path
|
||||
b.Config.Targets[""].Workspace = &config.Workspace{
|
||||
RootPath: "some-root-path",
|
||||
b.Config.Targets = map[string]*config.Target{
|
||||
"": {
|
||||
Workspace: &config.Workspace{
|
||||
RootPath: "some-root-path",
|
||||
},
|
||||
},
|
||||
}
|
||||
diags = validateProductionMode(context.Background(), b, false)
|
||||
require.NoError(t, diags.Error())
|
||||
|
|
Loading…
Reference in New Issue