]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: complete expiration header (object tags)
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 19 Feb 2019 16:17:45 +0000 (11:17 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 18 Jul 2019 20:01:43 +0000 (16:01 -0400)
The expiration header tag processing is complete, but the
passed RGWObjTags argument was never initialized.  Now it is
initialized in RGWGetObj and RGWPutObj, as required.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_lc.cc
src/rgw/rgw_op.cc

index 44969f1172b6a035f648f6d080b9ee276af2a63a..5175c87383981bd51848dda304efb2bd6a732aab 100644 (file)
@@ -1527,7 +1527,7 @@ std::string s3_expiration_header(
   const std::map<std::string, buffer::list>& bucket_attrs)
 {
   CephContext* cct = dpp->get_cct();
-  RGWLifecycleConfiguration config(cct); // TODO: save in bucket info
+  RGWLifecycleConfiguration config(cct);
   std::string hdr{""};
 
   const auto& aiter = bucket_attrs.find(RGW_ATTR_LC);
@@ -1630,8 +1630,7 @@ std::string s3_expiration_header(
     // update earliest expiration
     if (rule_expiration_date) {
       if ((! expiration_date) ||
-         ((expiration_date &&
-           (*expiration_date < *rule_expiration_date)))) {
+         (*expiration_date < *rule_expiration_date)) {
       expiration_date =
        boost::optional<ceph::real_time>(rule_expiration_date);
       }
index 45e45f0908e80fbc29178d97403fa3fad994b0c8..11c810aa8926d0af5f4ea68c94f7bb8004d9c7ba 100644 (file)
@@ -2046,6 +2046,22 @@ static bool object_is_expired(map<string, bufferlist>& attrs) {
   return false;
 }
 
+static inline void rgw_cond_decode_objtags(
+  struct req_state *s,
+  const std::map<std::string, buffer::list> &attrs)
+{
+  const auto& tags = attrs.find(RGW_ATTR_TAGS);
+  if (tags != attrs.end()) {
+    try {
+      bufferlist::const_iterator iter{&tags->second};
+      s->tagset.decode(iter);
+    } catch (buffer::error& err) {
+      ldout(s->cct, 0)
+       << "ERROR: caught buffer::error, couldn't decode TagSet" << dendl;
+    }
+  }
+}
+
 void RGWGetObj::execute()
 {
   bufferlist bl;
@@ -2176,6 +2192,9 @@ void RGWGetObj::execute()
     goto done_err;
   }
 
+  /* Decode S3 objtags, if any */
+  rgw_cond_decode_objtags(s, attrs);
+
   start = ofs;
 
   attr_iter = attrs.find(RGW_ATTR_MANIFEST);
@@ -3987,6 +4006,7 @@ void RGWPutObj::execute()
   }
   encode_delete_at_attr(delete_at, attrs);
   encode_obj_tags_attr(obj_tags.get(), attrs);
+  rgw_cond_decode_objtags(s, attrs);
 
   /* Add a custom metadata to expose the information whether an object
    * is an SLO or not. Appending the attribute must be performed AFTER