~joetalbott/adt-cloud-service/fix_reverse_logic_for_trailing_slash

« back to all changes in this revision

Viewing changes to adt_cloud_service/image.py

  • Committer: Ubuntu CI Bot
  • Author(s): Thomi Richards
  • Date: 2015-03-17 21:22:17 UTC
  • mfrom: (16.1.1 trunk-fix-socket-timeout)
  • Revision ID: ubuntu_ci_bot-20150317212217-fokx0pm3qzdumbex
Deal with socket timeouts while communicating with the image-mapper service. [r=Joe Talbott]

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import urllib.parse
21
21
import urllib.request
22
22
import json
 
23
import socket
23
24
 
24
25
from adt_cloud_service.errors import ImageMapperError
25
26
 
50
51
        except urllib.error.HTTPError as e:
51
52
            # Got an HTTP error from the image mapper:
52
53
            return process_image_mapper_result(e.code, e.file.read())
53
 
        except urllib.error.URLError as e:
 
54
        except (urllib.error.URLError, socket.timeout) as e:
54
55
            # Couldn't complete tcp handshake with image mapper:
55
56
            raise ImageMapperError(
56
57
                "Unable to contact adt-image-mapper service: {}".format(str(e))