Merge lp:~jibel/ubuntu/trusty/ubuntu-release-upgrader/dont_fail_if_no_apport into lp:ubuntu/trusty/ubuntu-release-upgrader

Proposed by Jean-Baptiste Lallement
Status: Merged
Merge reported by: Brian Murray
Merged at revision: not available
Proposed branch: lp:~jibel/ubuntu/trusty/ubuntu-release-upgrader/dont_fail_if_no_apport
Merge into: lp:ubuntu/trusty/ubuntu-release-upgrader
Diff against target: 59 lines (+24/-4)
1 file modified
DistUpgrade/DistUpgradeController.py (+24/-4)
To merge this branch: bzr merge lp:~jibel/ubuntu/trusty/ubuntu-release-upgrader/dont_fail_if_no_apport
Reviewer Review Type Date Requested Status
Brian Murray Needs Fixing
Review via email: mp+208550@code.launchpad.net

Description of the change

* DistUpgrade/DistUpgradeController.py: Catch exception if apport is not installed and fail gracefully (LP:#1285545)

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for working on this, I think instead of logging the error regarding apport-bug failing we should instead change the error message (e.g. lines 819-822) to not mention that a bug reporting process will be started and instead tell them how to report a bug. So something like:

if os.path.exists('/usr/bin/apport-bug'):
   self._view.error(existing message)
   subproces.Popen(bug reporting)
else:
   self._view.error("Install apport to report a bug...")
   logging.error("Could not automatically report a bug")

If that change makes sense do you want to work on it? or shall I?

review: Needs Fixing
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for the review. It makes sense to change it the way you suggest. Feel free to work.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

+ on it :)

Revision history for this message
Brian Murray (brian-murray) wrote :

revno: 2732
fixes bug: https://launchpad.net/bugs/1285545
committer: Brian Murray <email address hidden>
branch nick: trunk
timestamp: Wed 2014-03-05 10:56:34 -0800
message:
  DistUpgrade/DistUpgradeController.py: Catch exception if apport is not
  installed and fail gracefully. Thanks to Jean-Baptiste Lallement for the
  initial patch. (LP: #1285545)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DistUpgrade/DistUpgradeController.py'
2--- DistUpgrade/DistUpgradeController.py 2014-01-23 16:14:37 +0000
3+++ DistUpgrade/DistUpgradeController.py 2014-02-27 08:53:04 +0000
4@@ -820,7 +820,12 @@
5 _("Upgrading the repository information "
6 "resulted in a invalid file so a bug "
7 "reporting process is being started."))
8- subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
9+ try:
10+ subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
11+ except OSError:
12+ logging.error("The command 'apport-bug "
13+ "ubuntu-release-upgrader-core' failed (Is "
14+ "apport installed on your system?)")
15 return False
16
17 if self.sources_disabled:
18@@ -1642,7 +1647,12 @@
19 _("Preparing the system for the upgrade "
20 "failed so a bug reporting process is "
21 "being started."))
22- subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
23+ try:
24+ subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
25+ except OSError:
26+ logging.error("The command 'apport-bug "
27+ "ubuntu-release-upgrader-core' failed (Is "
28+ "apport installed on your system?)")
29 sys.exit(1)
30
31 # mvo: commented out for now, see #54234, this needs to be
32@@ -1661,7 +1671,12 @@
33 "\n"
34 "Additionally, a bug reporting process is "
35 "being started."))
36- subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
37+ try:
38+ subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
39+ except OSError:
40+ logging.error("The command 'apport-bug "
41+ "ubuntu-release-upgrader-core' failed (Is "
42+ "apport installed on your system?)")
43 self.abort()
44
45 # run a "apt-get update" now, its ok to ignore errors,
46@@ -1735,7 +1750,12 @@
47 "In the case of an overloaded mirror, you "
48 "may want to try the upgrade again later.")
49 % pkg)
50- subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
51+ try:
52+ subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"])
53+ except OSError:
54+ logging.error("The command 'apport-bug "
55+ "ubuntu-release-upgrader-core' failed (Is "
56+ "apport installed on your system?)")
57 self.abort()
58
59 # calc the dist-upgrade and see if the removals are ok/expected

Subscribers

People subscribed via source and target branches