Merge lp:~mdz/apport/ec2-uec into lp:~ubuntu-core-dev/ubuntu/karmic/apport/ubuntu

Proposed by Matt Zimmerman
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mdz/apport/ec2-uec
Merge into: lp:~ubuntu-core-dev/ubuntu/karmic/apport/ubuntu
Diff against target: 79 lines
2 files modified
bin/apport-cli (+14/-0)
data/general-hooks/ubuntu.py (+37/-0)
To merge this branch: bzr merge lp:~mdz/apport/ec2-uec
Reviewer Review Type Date Requested Status
Apport upstream developers Pending
Review via email: mp+12429@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/apport-cli'
2--- bin/apport-cli 2009-09-08 12:03:44 +0000
3+++ bin/apport-cli 2009-09-25 16:00:29 +0000
4@@ -388,6 +388,20 @@
5 else:
6 return f
7
8+ def open_url(self, url):
9+ text = _('''To continue, you must visit the following URL:
10+
11+%s
12+
13+You can launch a browser now, or copy this URL into a browser on another
14+computer.''' % url)
15+
16+ answer = self.ui_question_choice(text, ["Launch a browser now"], False)
17+
18+ #if self.ui_question_yesno(_('Do you want to launch a browser now?')):
19+ if answer == 0:
20+ apport.ui.UserInterface.open_url(self, url)
21+
22 if __name__ == '__main__':
23 app = CLIUserInterface()
24 if not app.run_argv():
25
26=== modified file 'data/general-hooks/ubuntu.py'
27--- data/general-hooks/ubuntu.py 2009-09-14 10:47:08 +0000
28+++ data/general-hooks/ubuntu.py 2009-09-25 16:00:29 +0000
29@@ -12,9 +12,13 @@
30
31 import apport.packaging
32 import re
33+from urlparse import urljoin
34+from urllib2 import urlopen
35 from apport.hookutils import *
36
37 def add_info(report):
38+ add_tags = []
39+
40 # crash reports from live system installer often expose target mount
41 for f in ('ExecutablePath', 'InterpreterPath'):
42 if f in report and report[f].startswith('/target/'):
43@@ -71,3 +75,36 @@
44 # do not file bugs against "upgrade-system" if it is not installed (LP#404727)
45 if package == 'upgrade-system' and 'not installed' in report['Package']:
46 report['UnreportableReason'] = 'You do not have the upgrade-system package installed. Please report package upgrade failures against the package that failed to install, or against upgrade-manager.'
47+
48+ # EC2 and Ubuntu Enterprise Cloud instances
49+ if apport.packaging.get_version('ec2-init') is not None:
50+ metadata_url = 'http://169.254.169.254/latest/meta-data/'
51+ ami_id_url = urljoin(metadata_url, 'ami-id')
52+
53+ try:
54+ ami = urlopen(ami_id_url).read()
55+ except:
56+ ami = None
57+
58+ if ami is None:
59+ cloud = None
60+ elif ami.startswith('ami'):
61+ cloud = 'ec2'
62+ add_tags.append('ec2-images')
63+
64+ # It would be great to translate these into meaningful Ubuntu versions -mdz
65+ report['Ec2AMI'] = ami
66+ report['Ec2AMIManifest'] = urlopen(urljoin(metadata_url, 'ami-manifest-path')).read()
67+ report['Ec2Kernel'] = urlopen(urljoin(metadata_url, 'kernel-id')).read()
68+ report['Ec2Ramdisk'] = urlopen(urljoin(metadata_url, 'ramdisk-id')).read()
69+ report['Ec2InstanceType'] = urlopen(urljoin(metadata_url, 'instance-type')).read()
70+ report['Ec2AvailabilityZone'] = urlopen(urljoin(metadata_url, 'placement/availability-zone')).read()
71+ else:
72+ cloud = 'uec'
73+ add_tags.append('uec-images')
74+
75+ if add_tags:
76+ if 'Tags' in report:
77+ report['Tags'] += ' ' + ' '.join(add_tags)
78+ else:
79+ report['Tags'] = ' '.join(add_tags)

Subscribers

People subscribed via source and target branches