Revision e99f9efb
b/kamaki/clients/image/__init__.py | ||
---|---|---|
103 | 103 |
|
104 | 104 |
:param name: (str) |
105 | 105 |
|
106 |
:param location: (str) pithos://<account>/<container>/<path> |
|
106 |
:param location: (str or iterable) if iterable, then |
|
107 |
(user_uuid, container, image_path) else if string |
|
108 |
pithos://<user_uuid>/<container>/<image object> |
|
107 | 109 |
|
108 | 110 |
:param params: (dict) image metadata (X-Image-Meta) can be id, store, |
109 | 111 |
disc_format, container_format, size, checksum, is_public, owner |
... | ... | |
114 | 116 |
""" |
115 | 117 |
path = path4url('images') + '/' |
116 | 118 |
self.set_header('X-Image-Meta-Name', name) |
119 |
location = location if ( |
|
120 |
isinstance(location, str) or isinstance(location, unicode)) else ( |
|
121 |
'pithos://%s' % '/'.join(location)) |
|
117 | 122 |
self.set_header('X-Image-Meta-Location', location) |
118 | 123 |
|
119 | 124 |
async_headers = {} |
b/kamaki/clients/image/test.py | ||
---|---|---|
224 | 224 |
props['%s%s' % (proprfx, args[i])] = k |
225 | 225 |
async_headers.update(props) |
226 | 226 |
r = self.client.register( |
227 |
img0_name, img0_location, |
|
228 |
params=params, properties=props) |
|
227 |
img0_name, img0_location, params=params, properties=props) |
|
229 | 228 |
expectedict = dict(example_image_headers) |
230 | 229 |
expectedict.pop('extraheaders') |
231 | 230 |
from kamaki.clients.image import _format_image_headers |
... | ... | |
236 | 235 |
self.assertEqual(SH.mock_calls[-2:], [ |
237 | 236 |
call('X-Image-Meta-Name', img0_name), |
238 | 237 |
call('X-Image-Meta-Location', img0_location)]) |
238 |
img1_location = ('some_uuid', 'some_container', 'some/path') |
|
239 |
r = self.client.register( |
|
240 |
img0_name, img1_location, params=params, properties=props) |
|
241 |
img1_location = 'pithos://%s' % '/'.join(img1_location) |
|
242 |
self.assertEqual(SH.mock_calls[-2:], [ |
|
243 |
call('X-Image-Meta-Name', img0_name), |
|
244 |
call('X-Image-Meta-Location', img1_location)]) |
|
239 | 245 |
|
240 | 246 |
@patch('%s.delete' % image_pkg) |
241 | 247 |
def test_unregister(self, delete): |
Also available in: Unified diff