From a4128494f55b8ad3b9fb122e5d2f2064de970f8a Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Thu, 15 Aug 2019 15:48:05 +0800 Subject: [PATCH] rgw: DefaultRetention requires either Days or Years Fixes: https://tracker.ceph.com/issues/41838 Signed-off-by: Chang Liu --- src/rgw/rgw_object_lock.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_object_lock.h b/src/rgw/rgw_object_lock.h index 0bdbea5568d..e84dd8d4d22 100644 --- a/src/rgw/rgw_object_lock.h +++ b/src/rgw/rgw_object_lock.h @@ -109,7 +109,10 @@ public: } bool retention_period_valid() const { - return (get_years() > 0 || get_days() > 0); + // DefaultRetention requires either Days or Years. + // You can't specify both at the same time. + // see https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTObjectLockConfiguration.html + return get_years() > 0 != get_days() > 0; } bool has_rule() const { -- 2.39.5