Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartkats-db committed Dec 27, 2023
1 parent 3d51177 commit bde524e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bundle/deploy/lock/acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (m *acquire) Apply(ctx context.Context, b *bundle.Bundle) error {
}

err := m.init(b)
existError := filer.NoSuchDirectoryError{}
if err != nil {
return err
}
Expand All @@ -51,8 +50,13 @@ func (m *acquire) Apply(ctx context.Context, b *bundle.Bundle) error {
err = b.Locker.Lock(ctx, force)
if err != nil {
log.Errorf(ctx, "Failed to acquire deployment lock: %v", err)

existError := filer.NoSuchDirectoryError{}
if errors.As(err, &existError) {
return fmt.Errorf("access denied to deployment root (this can indicate a previous deploy was done with a different identity): %s", b.Config.Workspace.RootPath)
// If we get a "doesn't exist" error from the API this indicates
// we either don't have permissions or the path is invalid.
// We'll assume the former to provide a more helpful error.
return fmt.Errorf("cannot write to deployment root (this can indicate a previous deploy was done with a different identity): %s", b.Config.Workspace.RootPath)
}
return err
}
Expand Down

0 comments on commit bde524e

Please sign in to comment.