From: Chang Liu Date: Thu, 15 Aug 2019 07:48:05 +0000 (+0800) Subject: rgw: DefaultRetention requires either Days or Years X-Git-Tag: v14.2.5~119^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de6b2874581eeaa42842359d68801a73b973991a;p=ceph.git rgw: DefaultRetention requires either Days or Years Fixes: https://tracker.ceph.com/issues/41838 Signed-off-by: Chang Liu (cherry picked from commit a4128494f55b8ad3b9fb122e5d2f2064de970f8a) --- diff --git a/src/rgw/rgw_object_lock.h b/src/rgw/rgw_object_lock.h index 4724907d1b0..ccd48b90667 100644 --- a/src/rgw/rgw_object_lock.h +++ b/src/rgw/rgw_object_lock.h @@ -106,7 +106,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 {