Merge lp:~brian-murray/ubuntu-archive-tools/pu-json-decode-error into lp:ubuntu-archive-tools

Proposed by Brian Murray
Status: Merged
Merged at revision: 967
Proposed branch: lp:~brian-murray/ubuntu-archive-tools/pu-json-decode-error
Merge into: lp:ubuntu-archive-tools
Diff against target: 29 lines (+10/-2)
1 file modified
phased-updater (+10/-2)
To merge this branch: bzr merge lp:~brian-murray/ubuntu-archive-tools/pu-json-decode-error
Reviewer Review Type Date Requested Status
Ubuntu Package Archive Administrators Pending
Review via email: mp+263148@code.launchpad.net

Description of the change

Fixes this Traceback:

Traceback (most recent call last):
  File "/home/ubuntu-archive/ubuntu-archive-tools/phased-updater", line 664, in <module>
    main()
  File "/home/ubuntu-archive/ubuntu-archive-tools/phased-updater", line 569, in main
    rate_increase = crash_rate_increase(release, src_pkg, version, max_pup)
  File "/home/ubuntu-archive/ubuntu-archive-tools/phased-updater", line 465, in crash_rate_increase
    rate_data = json.load(rate_file)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 357, in load
    use_decimal=use_decimal, **kw)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 413, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 405, in decode
    raise JSONDecodeError("Extra data", s, end, len(s))
simplejson.decoder.JSONDecodeError: Extra data: line 2 column 1 - line 32 column 1 (char 3 - 621)

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 'phased-updater'
2--- phased-updater 2015-06-23 16:15:41 +0000
3+++ phased-updater 2015-06-26 16:40:40 +0000
4@@ -385,7 +385,11 @@
5 if new_buckets_file.getcode() != 200:
6 logging.error('HTTP error retrieving %s' % new_buckets_url)
7 return 'error'
8- new_buckets_data = json.load(new_buckets_file)
9+ try:
10+ new_buckets_data = json.load(new_buckets_file)
11+ except json.decoder.JSONDecodeError:
12+ logging.error('Error getting new buckets at %s' % new_buckets_url)
13+ return 'error'
14 if 'error_message' in new_buckets_data.keys():
15 logging.error('Error getting new buckets at %s' % new_buckets_url)
16 return 'error'
17@@ -462,7 +466,11 @@
18 if rate_file.getcode() != 200:
19 logging.error('HTTP error retrieving %s' % rate_url)
20 return 'error'
21- rate_data = json.load(rate_file)
22+ try:
23+ rate_data = json.load(rate_file)
24+ except json.decoder.JSONDecodeError:
25+ logging.error('Error getting rate at %s' % rate_url)
26+ return 'error'
27 if 'error_message' in rate_data.keys():
28 logging.error('Error getting rate at %s' % rate_url)
29 return 'error'

Subscribers

People subscribed via source and target branches