Merge lp://staging/~kgoetz/merge-o-matic/mom-errorcatching into lp://staging/merge-o-matic

Proposed by KarlGoetz
Status: Merged
Merge reported by: Loïc Minier
Merged at revision: not available
Proposed branch: lp://staging/~kgoetz/merge-o-matic/mom-errorcatching
Merge into: lp://staging/merge-o-matic
Diff against target: 119 lines (+36/-7)
7 files modified
deb/controlfile.py (+5/-1)
momlib.py (+8/-1)
publish-patches.py (+5/-1)
stats-graphs.py (+5/-1)
syndicate.py (+6/-1)
update-pool.py (+5/-1)
update-sources.py (+2/-1)
To merge this branch: bzr merge lp://staging/~kgoetz/merge-o-matic/mom-errorcatching
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+20203@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
KarlGoetz (kgoetz) wrote :

This branch houses a couple of changes to improve error catching. The scripts should all exit(1) without backtracing when they are run from a 'cold start'. I've tried to make sure these changes are split out from the other branches I'm working on, sorry if I've missed a few things.

177. By KarlGoetz

Catch IOError. You'll see this if you can't lookup the hostname of your
mirror anymore.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'deb/controlfile.py'
2--- deb/controlfile.py 2008-01-10 13:19:44 +0000
3+++ deb/controlfile.py 2010-02-27 06:00:37 +0000
4@@ -62,7 +62,11 @@
5
6 def open(self, file, *args, **kwds):
7 """Open and parse a control-file format file."""
8- f = open(file)
9+ try:
10+ f = open(file)
11+ except IOError, e:
12+ print e
13+ exit(1)
14 try:
15 try:
16 self.parse(f, *args, **kwds)
17
18=== modified file 'momlib.py'
19--- momlib.py 2010-01-26 13:49:00 +0000
20+++ momlib.py 2010-02-27 06:00:37 +0000
21@@ -131,7 +131,14 @@
22 """Ensure that the parent directories for path exist."""
23 dirname = os.path.dirname(path)
24 if not os.path.isdir(dirname):
25- os.makedirs(dirname)
26+ try:
27+ os.makedirs(dirname)
28+ except IOError, e:
29+ print e
30+ except OSError, e:
31+ print e
32+ finally:
33+ exit(1)
34
35 def pathhash(path):
36 """Return the path hash component for path."""
37
38=== modified file 'publish-patches.py'
39--- publish-patches.py 2008-01-10 13:19:44 +0000
40+++ publish-patches.py 2010-02-27 06:00:37 +0000
41@@ -40,7 +40,11 @@
42
43 # Write to a new list
44 list_filename = patch_list_file()
45- list_file = open(list_filename + ".new", "w")
46+ try:
47+ list_file = open(list_filename + ".new", "w")
48+ except IOError, e:
49+ print e
50+ exit(1)
51 try:
52 # For each package in the distribution, check for a patch for the
53 # current version; publish if it exists, clean up if not
54
55=== modified file 'stats-graphs.py'
56--- stats-graphs.py 2008-01-10 13:19:44 +0000
57+++ stats-graphs.py 2010-02-27 06:00:37 +0000
58@@ -128,7 +128,11 @@
59 stats = {}
60
61 stats_file = "%s/stats.txt" % ROOT
62- stf = open(stats_file, "r");
63+ try:
64+ stf = open(stats_file, "r");
65+ except IOError, e:
66+ print e
67+ exit(1)
68 try:
69 for line in stf:
70 (date, time, component, info) = line.strip().split(" ", 3)
71
72=== modified file 'syndicate.py'
73--- syndicate.py 2009-05-29 07:14:42 +0000
74+++ syndicate.py 2010-02-27 06:00:37 +0000
75@@ -372,7 +372,12 @@
76 """Read the subscriptions file."""
77 subscriptions = []
78
79- f = open("%s/subscriptions.txt" % ROOT)
80+ try:
81+ f = open("%s/subscriptions.txt" % ROOT)
82+ except IOError, e:
83+ print e
84+ exit(1)
85+
86 try:
87 fcntl.flock(f.fileno(), fcntl.LOCK_SH)
88
89
90=== modified file 'update-pool.py'
91--- update-pool.py 2009-05-29 07:20:19 +0000
92+++ update-pool.py 2010-02-27 06:00:37 +0000
93@@ -50,7 +50,11 @@
94 if options.package is not None \
95 and source["Package"] not in options.package:
96 continue
97- update_pool(distro, source)
98+ try:
99+ update_pool(distro, source)
100+ except IOError, e:
101+ print e
102+ exit(1)
103
104
105 def sources_url(distro, dist, component):
106
107=== modified file 'update-sources.py'
108--- update-sources.py 2009-05-29 07:23:15 +0000
109+++ update-sources.py 2010-02-27 06:00:37 +0000
110@@ -33,7 +33,8 @@
111 for distro in distros:
112 try:
113 hparts = os.listdir("%s/pool/%s" % (ROOT, distro))
114- except OSError:
115+ except OSError, e:
116+ print e
117 continue
118 for hpart in hparts:
119 for package in os.listdir("%s/pool/%s/%s" % (ROOT, distro, hpart)):

Subscribers

People subscribed via source and target branches

to status/vote changes: