Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s3_lifecycle: support value '0' for transition_days (#1077)
s3_lifecycle: support value '0' for transition_days SUMMARY s3_lifecycle module does not support value 0 for transition_days parameter. ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION A lifecycle rule with 0 as transition_days allows to create a rule that will move objects with a delta of just few hours (if set to 1, objects will be moved with a delta of 1d + few hours). When the value 0 is set, the value is stripped from the query and we get an error that is hard to correlate with an "invalid" value on this parameter (which is valid as 0 is an integer): - name: Create s3 buckets lifecycle rules s3_lifecycle: ec2_url: "FIXME" region: "FIXME" aws_access_key: "FIXME" aws_secret_key: "FIXME" name: "FIXME" rule_id: "onezone" transitions: - transition_days: 0 storage_class: "ONEZONE_IA" state: present status: enabled fatal: [localhost]: FAILED! => { "boto3_version": "1.21.3", "botocore_version": "1.24.19", "changed": false, "error": { "code": "MalformedXML", "message": "Extra element Transition in interleave" }, "lifecycle_configuration": { "Rules": [ { "Filter": { "Prefix": "" }, "ID": "onezone", "Status": "Enabled", "Transitions": [ { "StorageClass": "ONEZONE_IA" } ] } ] }, ... MSG: An error occurred (MalformedXML) when calling the PutBucketLifecycleConfiguration operation: Extra element Transition in interleave This is because transition.get('transition_days') returns 0 which is considered as False on a condition (this patch just check if the value is defined; e.g. is not None). Reviewed-by: Mark Chappell <None> Reviewed-by: Markus Bergholz <[email protected]> (cherry picked from commit 4f989bd)
- Loading branch information