forked from TrueCloudLab/frostfs-s3-gw
[#463] Define default location constraint
Fixes `test_bucket_get_location` from s3-tests. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
087d500c5f
commit
89ff89a32b
1 changed files with 7 additions and 5 deletions
|
@ -28,6 +28,7 @@ type (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
attributeLocationConstraint = ".s3-location-constraint"
|
attributeLocationConstraint = ".s3-location-constraint"
|
||||||
|
defaultLocationConstraint = "default"
|
||||||
AttributeLockEnabled = "LockEnabled"
|
AttributeLockEnabled = "LockEnabled"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -123,6 +124,9 @@ func (n *layer) containerList(ctx context.Context) ([]*data.BucketInfo, error) {
|
||||||
func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*data.BucketInfo, error) {
|
func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*data.BucketInfo, error) {
|
||||||
var err error
|
var err error
|
||||||
ownerID := n.Owner(ctx)
|
ownerID := n.Owner(ctx)
|
||||||
|
if p.LocationConstraint == "" {
|
||||||
|
p.LocationConstraint = defaultLocationConstraint // s3tests_boto3.functional.test_s3:test_bucket_get_location
|
||||||
|
}
|
||||||
bktInfo := &data.BucketInfo{
|
bktInfo := &data.BucketInfo{
|
||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
Owner: ownerID,
|
Owner: ownerID,
|
||||||
|
@ -134,11 +138,9 @@ func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*da
|
||||||
|
|
||||||
var attributes [][2]string
|
var attributes [][2]string
|
||||||
|
|
||||||
if p.LocationConstraint != "" {
|
attributes = append(attributes, [2]string{
|
||||||
attributes = append(attributes, [2]string{
|
attributeLocationConstraint, p.LocationConstraint,
|
||||||
attributeLocationConstraint, p.LocationConstraint,
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if p.ObjectLockEnabled {
|
if p.ObjectLockEnabled {
|
||||||
attributes = append(attributes, [2]string{
|
attributes = append(attributes, [2]string{
|
||||||
|
|
Loading…
Reference in a new issue