cleanup account ids from container commands
use a common function to determine account ID instead of different ways - depending on the response and command Change-Id: I95adc5dc7d5a82a2cffc570d1ded24d1fc754a11
This commit is contained in:
parent
4733fd0d3c
commit
faece91756
@ -44,9 +44,8 @@ class APIv1(api.BaseAPI):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
response = self.create(container, method='PUT')
|
response = self.create(container, method='PUT')
|
||||||
url_parts = urlparse(self.endpoint)
|
|
||||||
data = {
|
data = {
|
||||||
'account': url_parts.path.split('/')[-1],
|
'account': self._find_account_id(),
|
||||||
'container': container,
|
'container': container,
|
||||||
'x-trans-id': response.headers.get('x-trans-id', None),
|
'x-trans-id': response.headers.get('x-trans-id', None),
|
||||||
}
|
}
|
||||||
@ -154,12 +153,13 @@ class APIv1(api.BaseAPI):
|
|||||||
|
|
||||||
response = self._request('HEAD', container)
|
response = self._request('HEAD', container)
|
||||||
data = {
|
data = {
|
||||||
'account': response.headers.get('x-container-meta-owner', None),
|
'account': self._find_account_id(),
|
||||||
'container': container,
|
'container': container,
|
||||||
'object_count': response.headers.get(
|
'object_count': response.headers.get(
|
||||||
'x-container-object-count',
|
'x-container-object-count',
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
|
'meta-owner': response.headers.get('x-container-meta-owner', None),
|
||||||
'bytes_used': response.headers.get('x-container-bytes-used', None),
|
'bytes_used': response.headers.get('x-container-bytes-used', None),
|
||||||
'read_acl': response.headers.get('x-container-read', None),
|
'read_acl': response.headers.get('x-container-read', None),
|
||||||
'write_acl': response.headers.get('x-container-write', None),
|
'write_acl': response.headers.get('x-container-write', None),
|
||||||
@ -194,9 +194,8 @@ class APIv1(api.BaseAPI):
|
|||||||
method='PUT',
|
method='PUT',
|
||||||
data=f,
|
data=f,
|
||||||
)
|
)
|
||||||
url_parts = urlparse(self.endpoint)
|
|
||||||
data = {
|
data = {
|
||||||
'account': url_parts.path.split('/')[-1],
|
'account': self._find_account_id(),
|
||||||
'container': container,
|
'container': container,
|
||||||
'object': object,
|
'object': object,
|
||||||
'x-trans-id': response.headers.get('X-Trans-Id', None),
|
'x-trans-id': response.headers.get('X-Trans-Id', None),
|
||||||
@ -352,10 +351,11 @@ class APIv1(api.BaseAPI):
|
|||||||
|
|
||||||
response = self._request('HEAD', "%s/%s" % (container, object))
|
response = self._request('HEAD', "%s/%s" % (container, object))
|
||||||
data = {
|
data = {
|
||||||
'account': response.headers.get('x-container-meta-owner', None),
|
'account': self._find_account_id(),
|
||||||
'container': container,
|
'container': container,
|
||||||
'object': object,
|
'object': object,
|
||||||
'content-type': response.headers.get('content-type', None),
|
'content-type': response.headers.get('content-type', None),
|
||||||
|
'meta-owner': response.headers.get('x-container-meta-owner', None),
|
||||||
}
|
}
|
||||||
if 'content-length' in response.headers:
|
if 'content-length' in response.headers:
|
||||||
data['content-length'] = response.headers.get(
|
data['content-length'] = response.headers.get(
|
||||||
|
@ -157,6 +157,7 @@ class TestContainer(TestObjectAPIv1):
|
|||||||
'container': 'qaz',
|
'container': 'qaz',
|
||||||
'object_count': '1',
|
'object_count': '1',
|
||||||
'bytes_used': '577',
|
'bytes_used': '577',
|
||||||
|
'meta-owner': FAKE_ACCOUNT,
|
||||||
'read_acl': None,
|
'read_acl': None,
|
||||||
'write_acl': None,
|
'write_acl': None,
|
||||||
'sync_to': None,
|
'sync_to': None,
|
||||||
@ -322,6 +323,7 @@ class TestObject(TestObjectAPIv1):
|
|||||||
'content-type': 'text/alpha',
|
'content-type': 'text/alpha',
|
||||||
'content-length': '577',
|
'content-length': '577',
|
||||||
'last-modified': '20130101',
|
'last-modified': '20130101',
|
||||||
|
'meta-owner': FAKE_ACCOUNT,
|
||||||
'etag': 'qaz',
|
'etag': 'qaz',
|
||||||
'wife': 'Wilma',
|
'wife': 'Wilma',
|
||||||
'x-tra-header': 'yabba-dabba-do',
|
'x-tra-header': 'yabba-dabba-do',
|
||||||
|
@ -316,6 +316,7 @@ class TestContainerShow(TestContainerAll):
|
|||||||
'account',
|
'account',
|
||||||
'bytes_used',
|
'bytes_used',
|
||||||
'container',
|
'container',
|
||||||
|
'meta-owner',
|
||||||
'object_count',
|
'object_count',
|
||||||
'read_acl',
|
'read_acl',
|
||||||
'sync_key',
|
'sync_key',
|
||||||
@ -327,6 +328,7 @@ class TestContainerShow(TestContainerAll):
|
|||||||
object_fakes.ACCOUNT_ID,
|
object_fakes.ACCOUNT_ID,
|
||||||
'123',
|
'123',
|
||||||
'ernie',
|
'ernie',
|
||||||
|
object_fakes.ACCOUNT_ID,
|
||||||
'42',
|
'42',
|
||||||
'qaz',
|
'qaz',
|
||||||
'rfv',
|
'rfv',
|
||||||
|
@ -160,6 +160,7 @@ class TestObjectShow(TestObjectAll):
|
|||||||
'content-type',
|
'content-type',
|
||||||
'etag',
|
'etag',
|
||||||
'last-modified',
|
'last-modified',
|
||||||
|
'meta-owner',
|
||||||
'object',
|
'object',
|
||||||
'x-object-manifest',
|
'x-object-manifest',
|
||||||
)
|
)
|
||||||
@ -171,6 +172,7 @@ class TestObjectShow(TestObjectAll):
|
|||||||
'text/plain',
|
'text/plain',
|
||||||
'4c4e39a763d58392724bccf76a58783a',
|
'4c4e39a763d58392724bccf76a58783a',
|
||||||
'yesterday',
|
'yesterday',
|
||||||
|
object_fakes.ACCOUNT_ID,
|
||||||
object_fakes.object_name_1,
|
object_fakes.object_name_1,
|
||||||
'manifest',
|
'manifest',
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user