Skip to content

Cannot specify multiple filters in bucket lifecycle configuration without using the And operator #638

Description

@aayushchouhan09

We cannot specify multiple filters in the bucket lifecycle configuration without wrapping them inside the logical And operator. But some of the ceph-s3 tests using rule having multiple filters without logical And, which is not allowed in aws and creating issue.

Below are some of the tests using such rules (please check for more):

  • test_lifecycle_expiration_tags1()
  • setup_lifecycle_tags2()
  • setup_lifecycle_noncur_tags()
  • test_lifecycle_expiration_size_gt()
  • test_lifecycle_expiration_size_lt()

Adding output of invalid rule:

$ aws s3api put-bucket-lifecycle-configuration --bucket aayush-buck --lifecycle-configuration '{
"Rules": [
{
"ID": "InvalidRule",
"Status": "Enabled",
"Filter": {
"Prefix": "logs/",
"Tag": {
"Key": "archive",
"Value": "true"
}
},
"Expiration": {
"Days": 30
}
}
]
}'
An error occurred (MalformedXML) when calling the PutBucketLifecycleConfiguration operation: The XML you provided was not well-formed or did not validate against our published schema

valid rule:

$ aws s3api put-bucket-lifecycle-configuration --bucket aayush-buck --lifecycle-configuration '{
"Rules": [
{
"ID": "PrefixAndTagRule",
"Status": "Enabled",
"Filter": {
"And": {
"Prefix": "logs/",
"Tags": [
{
"Key": "archive",
"Value": "true"
}
]
}
},
"Expiration": {
"Days": 30
}
}
]
}'

reference aws document: https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-filters.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions