Merge "Handle 403 forbidden on download"

This commit is contained in:
Jenkins
2016-02-29 13:04:08 +00:00
committed by Gerrit Code Review
4 changed files with 46 additions and 2 deletions
+6 -1
View File
@@ -276,7 +276,12 @@ def do_explain(gc, args):
help=_('Show download progress bar.'))
def do_image_download(gc, args):
"""Download a specific image."""
body = gc.images.data(args.id)
try:
body = gc.images.data(args.id)
except (exc.HTTPForbidden, exc.HTTPException) as e:
msg = "Unable to download image '%s'. (%s)" % (args.id, e)
utils.exit(msg)
if body is None:
msg = ('Image %s has no data.' % args.id)
utils.exit(msg)