Revision c4aefeaf kamaki/cli/commands/errors.py

b/kamaki/cli/commands/errors.py
358 358
        '* get a list of image ids: /image list',
359 359
        '* details of image: /flavor info <image id>']
360 360

  
361
    remote_image_file = [
362
        'Suggested usage:',
363
        '  /image register <image container>:<uploaded image file path>',
364
        'To set "image" as image container and "my_dir/img.diskdump" as',
365
        'the remote image file path, try one of the following:',
366
        '- <image container>:<remote path>',
367
        '    e.g. image:/my_dir/img.diskdump',
368
        '- <remote path> -C <image container>',
369
        '    e.g. /my_dir/img.diskdump -C image',
370
        'To check if the image file is accessible to current user:',
371
        '  /file list <image container>',
372
        'If the file is located under a different user id "us3r1d"',
373
        ' use the --fileowner=us3r1d  argument e.g.:',
374
        '  /image register "my" image:my_dir/img.diskdump --fileowner=us3r1d',
375
        'Note: The form pithos://<userid>/<container>/<path> is deprecated']
376

  
361 377
    @classmethod
362 378
    def connection(this, foo):
363 379
        return generic._connection(foo, 'image.url')
......
386 402
        def _raise(self, *args, **kwargs):
387 403
            key = kwargs.get('key', None)
388 404
            try:
389
                foo(self, *args, **kwargs)
405
                return foo(self, *args, **kwargs)
390 406
            except ClientError as ce:
391 407
                ce_msg = ('%s' % ce).lower()
392 408
                if ce.status == 404 or (
......
396 412
                raise
397 413
        return _raise
398 414

  
415
    @classmethod
416
    def image_file(this, foo):
417
        def _raise(self, name, container_path):
418
            try:
419
                return foo(self, name, container_path)
420
            except ClientError as ce:
421
                if ce.status in (400,):
422
                    raiseCLIError(
423
                        ce,
424
                        'Nonexistent location for %s' % container_path,
425
                        importance=2, details=this.remote_image_file)
426
                raise
427
        return _raise
428

  
399 429

  
400 430
class pithos(object):
401 431
    container_howto = [

Also available in: Unified diff