seeded-in-ubuntu: Catch errors in parsing data, and don't keep unreadable

data cached (LP: #1008783)
This commit is contained in:
Stefano Rivera 2012-06-20 22:28:35 +02:00
parent 139e5dfda7
commit fa83ac6b0b
2 changed files with 10 additions and 2 deletions

2
debian/changelog vendored
View File

@ -24,6 +24,8 @@ ubuntu-dev-tools (0.143) UNRELEASED; urgency=low
* Correct metavar for --mirror in backportpackage (LP: #999727)
* submittodebian: Explitictly UTF-8 encode the bug body (LP: #1005834)
* backportpackage.1: Document --key and --dont-sign (LP: #1007564)
* seeded-in-ubuntu: Catch errors in parsing data, and don't keep unreadable
data cached (LP: #1008783)
-- Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com> Wed, 06 Jun 2012 09:53:24 -0400

View File

@ -43,8 +43,14 @@ def load_index(url):
os.makedirs(cachedir)
urllib.urlretrieve(url, fn)
with gzip.open(fn, 'r') as f:
return json.load(f)
try:
with gzip.open(fn, 'r') as f:
return json.load(f)
except Exception, e:
Logger.error("Unable to parse seed data: %s. "
"Deleting cached data, please try again.",
str(e))
os.unlink(fn)
def resolve_binaries(sources):