[master/f20] Handle invalid JSON in geoloc (#1021410)

David Shea dshea at redhat.com
Mon Oct 21 15:45:08 UTC 2013


The json module raises ValueError when asked to decode something that
isn't valid JSON, which can happen, for example, if we receive a
response from a proxy instead of from the GeoIP server.
---
 pyanaconda/geoloc.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pyanaconda/geoloc.py b/pyanaconda/geoloc.py
index a6cbd0c..76771ff 100644
--- a/pyanaconda/geoloc.py
+++ b/pyanaconda/geoloc.py
@@ -553,6 +553,8 @@ class FedoraGeoIPProvider(GeolocationBackend):
             log.debug("Geoloc: HTTPError for Fedora GeoIP API lookup:\n%s", e)
         except urllib2.URLError as e:
             log.debug("Geoloc: URLError for Fedora GeoIP API lookup:\n%s", e)
+        except ValueError as e:
+            log.debug("Geoloc: Unable to decode GeoIP JSON:\n%s", e)
 
 
 class HostipGeoIPProvider(GeolocationBackend):
-- 
1.8.3.1



More information about the anaconda-patches mailing list