Merge lp:~barry/software-properties/lp1510558 into lp:software-properties

Proposed by Barry Warsaw on 2015-10-27
Status: Merged
Approved by: Brian Murray on 2015-10-27
Approved revision: 949
Merged at revision: 949
Proposed branch: lp:~barry/software-properties/lp1510558
Merge into: lp:software-properties
Diff against target: 68 lines (+23/-2)
3 files modified
debian/changelog (+8/-0)
softwareproperties/ppa.py (+6/-1)
tests/test_shortcuts.py (+9/-1)
To merge this branch: bzr merge lp:~barry/software-properties/lp1510558
Reviewer Review Type Date Requested Status
Brian Murray 2015-10-27 Approve on 2015-10-27
Review via email: mp+275854@code.launchpad.net

Description of the Change

Handles a failure mode we saw in promotion from xenial-proposed. Shortcut exceptions should allow other shortcuts a chance.

To post a comment you must log in.
Brian Murray (brian-murray) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-10-26 17:10:51 +0000
3+++ debian/changelog 2015-10-27 14:44:37 +0000
4@@ -1,3 +1,11 @@
5+software-properties (0.96.15) UNRELEASED; urgency=medium
6+
7+ * In ppa.py, shortcut_handler(), if a ShortcutException occurs, print
8+ the traceback to stderr and return None to allow other shortcut
9+ handlers to run. (LP: #1510558)
10+
11+ -- Barry Warsaw <barry@ubuntu.com> Tue, 27 Oct 2015 10:17:53 -0400
12+
13 software-properties (0.96.14) xenial; urgency=medium
14
15 * If a driver package depends on dkms and the correct linux meta package is
16
17=== modified file 'softwareproperties/ppa.py'
18--- softwareproperties/ppa.py 2015-10-13 18:30:57 +0000
19+++ softwareproperties/ppa.py 2015-10-27 14:44:37 +0000
20@@ -31,6 +31,7 @@
21
22 from gettext import gettext as _
23 from threading import Thread
24+from traceback import print_exc
25
26 from softwareproperties.shortcuts import ShortcutException
27
28@@ -388,7 +389,11 @@
29 def shortcut_handler(shortcut):
30 if not shortcut.startswith("ppa:"):
31 return None
32- return PPAShortcutHandler(shortcut)
33+ try:
34+ return PPAShortcutHandler(shortcut)
35+ except ShortcutException:
36+ print_exc()
37+ return None
38
39
40 if __name__ == "__main__":
41
42=== modified file 'tests/test_shortcuts.py'
43--- tests/test_shortcuts.py 2014-09-24 09:50:37 +0000
44+++ tests/test_shortcuts.py 2015-10-27 14:44:37 +0000
45@@ -7,7 +7,8 @@
46 sys.path.insert(0, "..")
47
48 from softwareproperties.SoftwareProperties import shortcut_handler
49-
50+from softwareproperties.ppa import HTTPError
51+from mock import patch
52
53
54 class ShortcutsTestcase(unittest.TestCase):
55@@ -41,6 +42,13 @@
56 '/etc/apt/sources.list.d/cloudarchive-folsom.list'),
57 handler.expand("precise", distro="ubuntu"))
58
59+ def test_shortcut_exception(self):
60+ with patch('softwareproperties.ppa.get_ppa_info_from_lp',
61+ side_effect=HTTPError):
62+ with patch('softwareproperties.ppa.print_exc') as mock:
63+ shortcut_handler("ppa:mvo")
64+ self.assertTrue(mock.called)
65+
66
67 if __name__ == "__main__":
68 unittest.main()

Subscribers

People subscribed via source and target branches

to status/vote changes: