mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-11-13 09:31:46 +01:00
archivist: versioning check becomes a startup warning in code
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -38,13 +39,13 @@ func New(endpoint, accessKey, secretKey, bucket string, useSSL bool) (*Client, e
|
|||||||
if !exists {
|
if !exists {
|
||||||
return nil, fmt.Errorf("bucket %q does not exist", bucket)
|
return nil, fmt.Errorf("bucket %q does not exist", bucket)
|
||||||
}
|
}
|
||||||
// US-01: the bucket must be versioned (delete markers keep data recoverable).
|
// Versioning is not required, but recommended: without it, any deletion
|
||||||
vc, err := mc.GetBucketVersioning(ctx, bucket)
|
// performed by the application (or by a bug) is final; with it, delete
|
||||||
if err != nil {
|
// markers keep deleted objects recoverable.
|
||||||
return nil, fmt.Errorf("versioning check: %w", err)
|
if vc, err := mc.GetBucketVersioning(ctx, bucket); err != nil {
|
||||||
}
|
log.Printf("warning: could not check bucket versioning: %v", err)
|
||||||
if vc.Status != "Enabled" {
|
} else if vc.Status != "Enabled" {
|
||||||
return nil, fmt.Errorf("bucket %q is not versioned (status %q)", bucket, vc.Status)
|
log.Printf("warning: bucket %q has versioning disabled; consider enabling it to reduce the risk of losing a file to a bug", bucket)
|
||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user