2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-04 10:00:48 +00:00

Merge pull request #4084 from ekarlso/azure-stat-fix

fix: Make create not error out when ContainerNotFound
This commit is contained in:
Michael Eischer 2022-12-13 22:49:05 +01:00 committed by GitHub
commit 1c071a462e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,6 +130,8 @@ func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, er
return nil, errors.Wrap(err, "open") return nil, errors.Wrap(err, "open")
} }
_, err = be.container.GetProperties(ctx, &azContainer.GetPropertiesOptions{})
if err != nil && bloberror.HasCode(err, bloberror.ContainerNotFound) { if err != nil && bloberror.HasCode(err, bloberror.ContainerNotFound) {
_, err = be.container.Create(ctx, &azContainer.CreateOptions{}) _, err = be.container.Create(ctx, &azContainer.CreateOptions{})
@ -363,7 +365,7 @@ func (be *Backend) Remove(ctx context.Context, h restic.Handle) error {
debug.Log("Remove(%v) at %v -> err %v", h, objName, err) debug.Log("Remove(%v) at %v -> err %v", h, objName, err)
if bloberror.HasCode(err, bloberror.BlobNotFound) { if be.IsNotExist(err) {
return nil return nil
} }