Merge lp:~thomir-deactivatedaccount/adt-cloud-service/trunk-fix-socket-timeout into lp:adt-cloud-service

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 17
Merged at revision: 17
Proposed branch: lp:~thomir-deactivatedaccount/adt-cloud-service/trunk-fix-socket-timeout
Merge into: lp:adt-cloud-service
Diff against target: 20 lines (+2/-1)
1 file modified
adt_cloud_service/image.py (+2/-1)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/adt-cloud-service/trunk-fix-socket-timeout
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Review via email: mp+253279@code.launchpad.net

Commit message

Deal with socket timeouts while communicating with the image-mapper service.

Description of the change

Catch socket timeouts while talking to the image-mapper service, and report a nice error to the caller.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'adt_cloud_service/image.py'
2--- adt_cloud_service/image.py 2015-03-16 23:43:12 +0000
3+++ adt_cloud_service/image.py 2015-03-17 21:09:27 +0000
4@@ -20,6 +20,7 @@
5 import urllib.parse
6 import urllib.request
7 import json
8+import socket
9
10 from adt_cloud_service.errors import ImageMapperError
11
12@@ -50,7 +51,7 @@
13 except urllib.error.HTTPError as e:
14 # Got an HTTP error from the image mapper:
15 return process_image_mapper_result(e.code, e.file.read())
16- except urllib.error.URLError as e:
17+ except (urllib.error.URLError, socket.timeout) as e:
18 # Couldn't complete tcp handshake with image mapper:
19 raise ImageMapperError(
20 "Unable to contact adt-image-mapper service: {}".format(str(e))

Subscribers

People subscribed via source and target branches

to all changes: