Commit cb4f2809 authored by rgaudin's avatar rgaudin
Browse files

Checking catalog content after download so catalog encoding issues are raised properly

parent be11dfcc
......@@ -2,6 +2,7 @@
# vim: ai ts=4 sts=4 et sw=4 nu
import os
import random
import tempfile
import yaml
......@@ -34,6 +35,24 @@ def fetch_catalogs(logger):
raise ValueError("Unable to download {}".format(catalog.get("url")))
# ensure the content is readable (prevent incorrect encoding)
entry = catalogs[-1]["all"][random.choice(list(catalogs[-1]["all"].keys()))]
for key in (
if not entry.get(key) or not isinstance(entry[key], str):
logger.err("Catalog format is not valid")
catalogs.pop() # remove catalog from list
except Exception as exp:
logger.err("Exception while downloading/parsing catalogs: {}".format(exp))
return None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment