From 330522341a6a200760698b64af18d07dca5f99d2 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen <jim.rollenhagen@rackspace.com> Date: Wed, 15 Jan 2014 17:01:19 -0800 Subject: [PATCH] catch streaming errors --- teeth_agent/standby.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/teeth_agent/standby.py b/teeth_agent/standby.py index a79de79e3..106389ed0 100644 --- a/teeth_agent/standby.py +++ b/teeth_agent/standby.py @@ -73,8 +73,11 @@ def _download_image(image_info): image_location = _image_location(image_info) with open(image_location, 'wb') as f: - for chunk in resp.iter_content(1024 * 1024): - f.write(chunk) + try: + for chunk in resp.iter_content(1024 * 1024): + f.write(chunk) + except Exception: + raise errors.ImageDownloadError(image_info['id']) if not _verify_image(image_info, image_location): raise errors.ImageChecksumError(image_info['id'])