mirror of https://github.com/databricks/cli.git
respect --force flag
This commit is contained in:
parent
6ecf48e163
commit
7d2d522497
|
@ -37,13 +37,15 @@ func (s *statePush) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostic
|
|||
}
|
||||
defer local.Close()
|
||||
|
||||
state, err := local.Stat()
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
if !b.Config.Bundle.Force {
|
||||
state, err := local.Stat()
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
if state.Size() > MaxStateFileSize {
|
||||
return diag.Errorf("Deployment state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle and/or split your bundle into multiple.", MaxStateFileSize)
|
||||
if state.Size() > MaxStateFileSize {
|
||||
return diag.Errorf("Deployment state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle, split your bundle into multiple or re-run the command with --force flag.", MaxStateFileSize)
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof(ctx, "Writing local deployment state file to remote state directory")
|
||||
|
|
|
@ -47,13 +47,15 @@ func (l *statePush) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostic
|
|||
}
|
||||
defer local.Close()
|
||||
|
||||
state, err := local.Stat()
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
if !b.Config.Bundle.Force {
|
||||
state, err := local.Stat()
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
if state.Size() > deploy.MaxStateFileSize {
|
||||
return diag.Errorf("Terraform state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle and/or split your bundle into multiple.", deploy.MaxStateFileSize)
|
||||
if state.Size() > deploy.MaxStateFileSize {
|
||||
return diag.Errorf("Terraform state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle, split your bundle into multiple or re-run the command with --force flag", deploy.MaxStateFileSize)
|
||||
}
|
||||
}
|
||||
|
||||
// Upload state file from local cache directory to filer.
|
||||
|
|
Loading…
Reference in New Issue