diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-05-25 21:15:09 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-05-25 21:15:09 +0000 |
commit | 0c244b24bd70c8ae54b0ed5e6096043f780a0eab (patch) | |
tree | fd0f1f7e507b9c7a972b203ea239e0d4d97431ae /glanceclient/v1 | |
parent | 048e763b75c5c1a0f18bf461577751386043c2d0 (diff) | |
parent | 583adc34f8cd4abd1048c57c058e88b8c68d5780 (diff) | |
download | python-glanceclient-0c244b24bd70c8ae54b0ed5e6096043f780a0eab.tar.gz |
Merge "Check image-download for redirection"
Diffstat (limited to 'glanceclient/v1')
-rw-r--r-- | glanceclient/v1/shell.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py index e0a373a..692f9bc 100644 --- a/glanceclient/v1/shell.py +++ b/glanceclient/v1/shell.py @@ -147,8 +147,8 @@ def do_image_show(gc, args): @utils.arg('--file', metavar='<FILE>', help='Local file to save downloaded image data to. ' - 'If this is not specified the image data will be ' - 'written to stdout.') + 'If this is not specified and there is no redirection ' + 'the image data will be not be saved.') @utils.arg('image', metavar='<IMAGE>', help='Name or ID of image to download.') @utils.arg('--progress', action='store_true', default=False, help='Show download progress bar.') @@ -158,7 +158,12 @@ def do_image_download(gc, args): body = image.data() if args.progress: body = progressbar.VerboseIteratorWrapper(body, len(body)) - utils.save_image(body, args.file) + if not (sys.stdout.isatty() and args.file is None): + utils.save_image(body, args.file) + else: + print('No redirection or local file specified for downloaded image ' + 'data. Please specify a local file with --file to save ' + 'downloaded image or redirect output to another source.') @utils.arg('--id', metavar='<IMAGE_ID>', |