Actions
Feature #24443
closedbucket tagging not working properly
% Done:
0%
Source:
Tags:
Backport:
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