Revision ca5b9261 kamaki/cli/commands/image.py
b/kamaki/cli/commands/image.py | ||
---|---|---|
59 | 59 |
|
60 | 60 |
howto_image_file = [ |
61 | 61 |
'Kamaki commands to:', |
62 |
' get current user uuid: /user authenticate',
|
|
62 |
' get current user id: /user authenticate', |
|
63 | 63 |
' check available containers: /file list', |
64 | 64 |
' create a new container: /file create <container>', |
65 | 65 |
' check container contents: /file list <container>', |
... | ... | |
153 | 153 |
|
154 | 154 |
def _validate_image_location(location): |
155 | 155 |
""" |
156 |
:param location: (str) pithos://<uuid>/<container>/<img-file-path>
|
|
156 |
:param location: (str) pithos://<user-id>/<container>/<img-file-path>
|
|
157 | 157 |
|
158 |
:returns: (<uuid>, <container>, <img-file-path>)
|
|
158 |
:returns: (<user-id>, <container>, <img-file-path>)
|
|
159 | 159 |
|
160 | 160 |
:raises AssertionError: if location is invalid |
161 | 161 |
""" |
... | ... | |
163 | 163 |
msg = 'Invalid prefix for location %s , try: %s' % (location, prefix) |
164 | 164 |
assert location.startswith(prefix), msg |
165 | 165 |
service, sep, rest = location.partition('://') |
166 |
assert sep and rest, 'Location %s is missing uuid' % location
|
|
166 |
assert sep and rest, 'Location %s is missing user-id' % location
|
|
167 | 167 |
uuid, sep, rest = rest.partition('/') |
168 | 168 |
assert sep and rest, 'Location %s is missing container' % location |
169 | 169 |
container, sep, img_path = rest.partition('/') |
... | ... | |
380 | 380 |
'No image file location provided', |
381 | 381 |
importance=2, details=[ |
382 | 382 |
'An image location is needed. Image location format:', |
383 |
' pithos://<uuid>/<container>/<path>',
|
|
383 |
' pithos://<user-id>/<container>/<path>',
|
|
384 | 384 |
' an image file at the above location must exist.' |
385 | 385 |
] + howto_image_file) |
386 | 386 |
try: |
... | ... | |
390 | 390 |
ae, 'Invalid image location format', |
391 | 391 |
importance=1, details=[ |
392 | 392 |
'Valid image location format:', |
393 |
' pithos://<uuid>/<container>/<img-file-path>'
|
|
393 |
' pithos://<user-id>/<container>/<img-file-path>'
|
|
394 | 394 |
] + howto_image_file) |
395 | 395 |
|
396 | 396 |
@errors.generic.all |
Also available in: Unified diff