mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
fix(gcs): failed locks due to upstream library error check changes (#31274)
After https://github.com/googleapis/google-cloud-go/pull/11519, errors must be checked with `errors.Is`. Addresses #31125. Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
This commit is contained in:
parent
fc249a43b1
commit
9ff8f7e4c2
3 changed files with 6 additions and 3 deletions
3
changelog/31274.txt
Normal file
3
changelog/31274.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
gcs: fix failed locking due to updated library error checks
|
||||
```
|
||||
|
|
@ -221,7 +221,7 @@ func (b *Backend) Get(ctx context.Context, key string) (retEntry *physical.Entry
|
|||
|
||||
// Read
|
||||
r, err := b.client.Bucket(b.bucket).Object(key).NewReader(ctx)
|
||||
if err == storage.ErrObjectNotExist {
|
||||
if errors.Is(err, storage.ErrObjectNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
|
|
@ -258,7 +258,7 @@ func (b *Backend) Delete(ctx context.Context, key string) error {
|
|||
|
||||
// Delete
|
||||
err := b.client.Bucket(b.bucket).Object(key).Delete(ctx)
|
||||
if err != nil && err != storage.ErrObjectNotExist {
|
||||
if err != nil && !errors.Is(err, storage.ErrObjectNotExist) {
|
||||
return fmt.Errorf("failed to delete key %q: %w", key, err)
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ func (l *Lock) writeLock() (bool, error) {
|
|||
func (l *Lock) get(ctx context.Context) (*LockRecord, error) {
|
||||
// Read
|
||||
attrs, err := l.backend.haClient.Bucket(l.backend.bucket).Object(l.key).Attrs(ctx)
|
||||
if err == storage.ErrObjectNotExist {
|
||||
if errors.Is(err, storage.ErrObjectNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue