Merge lp:~smoser/ubuntu/precise/apport/ec2-metadata-timeout into lp:~ubuntu-core-dev/ubuntu/precise/apport/ubuntu

Proposed by Scott Moser
Status: Merged
Merged at revision: 1931
Proposed branch: lp:~smoser/ubuntu/precise/apport/ec2-metadata-timeout
Merge into: lp:~ubuntu-core-dev/ubuntu/precise/apport/ubuntu
Diff against target: 41 lines (+9/-3)
2 files modified
data/general-hooks/ubuntu.py (+3/-2)
debian/changelog (+6/-1)
To merge this branch: bzr merge lp:~smoser/ubuntu/precise/apport/ec2-metadata-timeout
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+100552@code.launchpad.net

Description of the change

timeout on attempts to contact ec2 metadata service

Instead of hanging forever, timeout after 5 seconds. Any reasonable metadata service would come back in that amount of time.

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/general-hooks/ubuntu.py'
2--- data/general-hooks/ubuntu.py 2012-04-02 15:48:09 +0000
3+++ data/general-hooks/ubuntu.py 2012-04-03 04:48:17 +0000
4@@ -269,7 +269,7 @@
5 ami_id_url = urljoin(metadata_url, 'ami-id')
6
7 try:
8- ami = urlopen(ami_id_url).read()
9+ ami = urlopen(ami_id_url, timeout=5).read()
10 except:
11 ami = None
12
13@@ -287,7 +287,8 @@
14 report['Ec2AMI'] = ami
15 for key,value in fields.items():
16 try:
17- report[key]=urlopen(urljoin(metadata_url, value)).read()
18+ report[key]=urlopen(urljoin(metadata_url, value),
19+ timeout=5).read()
20 except:
21 report[key]='unavailable'
22 else:
23
24=== modified file 'debian/changelog'
25--- debian/changelog 2012-04-02 15:48:09 +0000
26+++ debian/changelog 2012-04-03 04:48:17 +0000
27@@ -1,9 +1,14 @@
28 apport (2.0-0ubuntu3) UNRELEASED; urgency=low
29
30+ [Martin Pitt]
31 * data/general-hooks/ubuntu.py: Do not capture stderr of lsb_release.
32 (LP: #955111)
33
34- -- Martin Pitt <martin.pitt@ubuntu.com> Mon, 02 Apr 2012 17:47:50 +0200
35+ [Scott Moser]
36+ * data/general-hooks/ubuntu.py: timeout on attempts to contact ec2 metadata
37+ service (LP: #855651)
38+
39+ -- Scott Moser <smoser@ubuntu.com> Tue, 03 Apr 2012 00:44:10 -0400
40
41 apport (2.0-0ubuntu2) precise; urgency=low
42

Subscribers

People subscribed via source and target branches