azure: Make create not error out when ContainerNotFound

This commit is contained in:
Endre Karlson 2022-12-11 22:04:00 +01:00
parent eae7366563
commit 7dd33c0ecc
1 changed files with 3 additions and 1 deletions

View File

@ -130,6 +130,8 @@ func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, er
return nil, errors.Wrap(err, "open")
}
_, err = be.container.GetProperties(ctx, &azContainer.GetPropertiesOptions{})
if err != nil && bloberror.HasCode(err, bloberror.ContainerNotFound) {
_, 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)
if bloberror.HasCode(err, bloberror.BlobNotFound) {
if be.IsNotExist(err) {
return nil
}