Fix set ACL fails to existing bucket

ACL API should be called against to an existing bucket.
However current swift3 returns 409 Bucket Already Exists
when the target bucket has already existed.

We should make it to return 200 OK when we can put the ACL
successfully.

Change-Id: I1de6379cbe1fd3eeb7bbcb52a3cf72c5821dfede
This commit is contained in:
Kota Tsuyuzaki
2014-10-16 21:37:34 -07:00
parent f37ecbb418
commit f80339c110
2 changed files with 5 additions and 2 deletions

View File

@@ -187,7 +187,7 @@ class AclController(Controller):
for header, acl in translated_acl: for header, acl in translated_acl:
req.headers[header] = acl req.headers[header] = acl
resp = req.get_response(self.app) resp = req.get_response(self.app, 'POST')
resp.status = HTTP_OK resp.status = HTTP_OK
resp.headers.update({'Location': req.container_name}) resp.headers.update({'Location': req.container_name})

View File

@@ -15,7 +15,7 @@
import unittest import unittest
from swift.common.swob import Request from swift.common.swob import Request, HTTPAccepted
from swift3.test.unit import Swift3TestCase from swift3.test.unit import Swift3TestCase
from swift3.etree import fromstring, tostring, Element, SubElement from swift3.etree import fromstring, tostring, Element, SubElement
@@ -28,6 +28,9 @@ class TestSwift3Acl(Swift3TestCase):
def setUp(self): def setUp(self):
super(TestSwift3Acl, self).setUp() super(TestSwift3Acl, self).setUp()
# All ACL API should be called against to existing bucket.
self.swift.register('PUT', '/v1/AUTH_test/bucket',
HTTPAccepted, {}, None)
def _check_acl(self, owner, body): def _check_acl(self, owner, body):
elem = fromstring(body, 'AccessControlPolicy') elem = fromstring(body, 'AccessControlPolicy')