Project

General

Profile

Actions

Feature #24443

closed

bucket tagging not working properly

Added by hoan nv almost 6 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

Hi all.

I am testing bucket tagging.

This is my script test

bucket = conn.get_bucket('test-bucket1')
tags = Tags()
tagset = TagSet()
tagset.add_tag('path', "test123")
tags.add_tag_set(tagset)
bucket.set_tags(test)

It return 400 bad request
this is log radosgw


/bucket-tagging/?tagging
2018-06-07 14:46:26.602438 7faedf5e1700 15 server signature=Zu6KV8pkOBCZcEToHYshYVReuEM=
2018-06-07 14:46:26.602439 7faedf5e1700 15 client signature=Zu6KV8pkOBCZcEToHYshYVReuEM=
2018-06-07 14:46:26.602440 7faedf5e1700 15 compare=0
2018-06-07 14:46:26.602460 7faedf5e1700 20 rgw::auth::s3::LocalEngine granted access
2018-06-07 14:46:26.602461 7faedf5e1700 20 rgw::auth::s3::AWSAuthStrategy granted access
2018-06-07 14:46:26.602466 7faedf5e1700  2 req 78:0.000365:s3:PUT /bucket-tagging/:create_bucket:normalizing buckets and tenants
2018-06-07 14:46:26.602472 7faedf5e1700 10 s->object=<NULL> s->bucket=bucket-tagging
2018-06-07 14:46:26.602478 7faedf5e1700  2 req 78:0.000373:s3:PUT /bucket-tagging/:create_bucket:init permissions
2018-06-07 14:46:26.602480 7faedf5e1700  2 req 78:0.000379:s3:PUT /bucket-tagging/:create_bucket:recalculating target
2018-06-07 14:46:26.602482 7faedf5e1700  2 req 78:0.000381:s3:PUT /bucket-tagging/:create_bucket:reading permissions
2018-06-07 14:46:26.602488 7faedf5e1700  2 req 78:0.000384:s3:PUT /bucket-tagging/:create_bucket:init op
2018-06-07 14:46:26.602490 7faedf5e1700  2 req 78:0.000389:s3:PUT /bucket-tagging/:create_bucket:verifying op mask
2018-06-07 14:46:26.602492 7faedf5e1700 20 required_mask= 2 user.op_mask=7
2018-06-07 14:46:26.602493 7faedf5e1700  2 req 78:0.000392:s3:PUT /bucket-tagging/:create_bucket:verifying op permissions
2018-06-07 14:46:26.604204 7faedf5e1700  2 req 78:0.002103:s3:PUT /bucket-tagging/:create_bucket:verifying op params
2018-06-07 14:46:26.604223 7faedf5e1700  2 req 78:0.002121:s3:PUT /bucket-tagging/:create_bucket:pre-executing
2018-06-07 14:46:26.604226 7faedf5e1700  2 req 78:0.002125:s3:PUT /bucket-tagging/:create_bucket:executing
2018-06-07 14:46:26.604247 7faedf5e1700  5 NOTICE: call to do_aws4_auth_completion
2018-06-07 14:46:26.604359 7faedf5e1700 20 create bucket input data=<Tagging><TagSet><Tag><Key>path</Key><Value>test123</Value></Tag></TagSet></Tagging>
2018-06-07 14:46:26.604362 7faedf5e1700  0 provided input did not specify location constraint correctly
2018-06-07 14:46:26.604369 7faedf5e1700  2 req 78:0.002268:s3:PUT /bucket-tagging/:create_bucket:completing
2018-06-07 14:46:26.604550 7faedf5e1700  2 req 78:0.002448:s3:PUT /bucket-tagging/:create_bucket:op status=-22
2018-06-07 14:46:26.604560 7faedf5e1700  2 req 78:0.002459:s3:PUT /bucket-tagging/:create_bucket:http status=400
2018-06-07 14:46:26.604565 7faedf5e1700  1 ====== req done req=0x7faedf5db2c0 op status=-22 http_status=400 ======

I see file https://github.com/ceph/ceph/blob/2a724a2ff313701fd7f6278ce8ed7f440bb355e0/src/rgw/rgw_rest_s3.cc line 1209, this function call to other function

bool get_location_constraint(string& zone_group) {
    XMLObj *config = find_first("CreateBucketConfiguration");
    if (!config)
      return false;

    XMLObj *constraint = config->find_first("LocationConstraint");
    if (!constraint)
      return false;

    zone_group = constraint->get_data();

    return true;
}

I think it required CreateBucketConfiguration and LocationConstraint tags.
So i add to tags

bucket = conn.get_bucket('test-bucket1')
tags = Tags()
tagset = TagSet()
tagset.add_tag('test-key', "test-value")
tags.add_tag_set(tagset)
test = "<CreateBucketConfiguration>"+"<LocationConstraint>test-zone</LocationConstraint>"+tags.to_xml()+"</CreateBucketConfiguration>" 
bucket.set_xml_tags(test)

result of this command

Traceback (most recent call last):
  File "user1.py", line 427, in <module>
    main()
  File "user1.py", line 355, in main
    bucket.set_xml_tags(test)
  File "/usr/lib/python2.7/site-packages/boto/s3/bucket.py", line 1862, in set_xml_tags
    response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 200 OK

Thanks.

Actions #1

Updated by Abhishek Lekshmanan almost 6 years ago

We don't have support for bucket tagging yet, only object tagging support exists; though it wouldnt be that difficult to add the API bits

Actions #2

Updated by hoan nv almost 6 years ago

You should change this issue to feature and backport to mimic,nautilus.

Bucket policy had s3:GetBucketTagging and s3:PutBucketTagging actions.

Thanks

Actions #3

Updated by Abhishek Lekshmanan almost 6 years ago

  • Tracker changed from Bug to Feature
  • Assignee set to Abhishek Lekshmanan
Actions #4

Updated by Simon Leinen over 5 years ago

Could you add a line to http://docs.ceph.com/docs/master/radosgw/s3/ to track the implementation status of this "Bucket Tagging" feature? Thanks!

Actions #5

Updated by Konstantin Shalygin about 5 years ago

PHP reproducer:

<?php

# https://github.com/aws/aws-sdk-php
require 'aws-sdk/aws-autoloader.php';

use Aws\S3\S3Client;

function main() {
  $s3 = new S3Client(['region' => 'us-east-1', 'version' => 'latest',
                      'endpoint' => 'https://rgw_civetweb',
                      'use_path_style_endpoint' => true,
                      'signature_version' => 'v4',
                      'credentials' => [
                        'key' => 'abc',
                        'secret' => 'xyz',
                      ],
  ]);

  $s3_bucket = "my_bucket";

  $s3_bucket_tagging = $s3->putBucketTagging([
    "Bucket" => $s3_bucket,
    "Tagging" => [
      "TagSet" => [
        [
          "Key" => "User",
          "Value" => "Bob",
        ],
      ],
    ],
  ]);

  $s3_bucket_tags = $s3->getBucketTagging([
    "Bucket" => $s3_bucket
  ]);

  echo($s3_bucket_tags);

}

main()

?>

Reproduced with Luminous 12.2.11

2019-03-14 11:44:19.780848 7f2532f47700  1 ====== starting new request req=0x7f2532f40f90 =====
2019-03-14 11:44:19.782193 7f2532f47700  0 provided input did not specify location constraint correctly
2019-03-14 11:44:19.782297 7f2532f47700  1 ====== req done req=0x7f2532f40f90 op status=-22 http_status=400 ======
2019-03-14 11:44:19.782338 7f2532f47700  1 civetweb: 0x557ecc7dc000: 109.202.30.156 - - [14/Mar/2019:11:44:19 +0700] "PUT /my_bucket?tagging HTTP/1.1" 400 0 - aws-sdk-php/3.69.16 GuzzleHttp/6.3.3 curl/7.64.0 PHP/7.3.3

Actions #6

Updated by Casey Bodley about 5 years ago

bucket tagging is not implemented, so this issue tracks it as a feature request

Actions #7

Updated by Chang Liu almost 5 years ago

  • Pull request ID set to 27993
Actions #8

Updated by Abhishek Lekshmanan over 4 years ago

  • Status changed from New to Resolved
  • Target version deleted (v12.2.6)

merged in master (will be in octopus)

Actions

Also available in: Atom PDF