diff --git a/src/pylorax/api/dnfbase.py b/src/pylorax/api/dnfbase.py index d7f3e200..c551ccad 100644 --- a/src/pylorax/api/dnfbase.py +++ b/src/pylorax/api/dnfbase.py @@ -82,7 +82,11 @@ def get_base_object(conf): # Update the metadata from the enabled repos to speed up later operations log.info("Updating repository metadata") - dbo.fill_sack(load_system_repo=False) - dbo.read_comps() + try: + dbo.fill_sack(load_system_repo=False) + dbo.read_comps() + except dnf.exceptions.Error as e: + log.error("Failed to update metadata: %s", str(e)) + raise RuntimeError("Fetching metadata failed: %s" % str(e)) return dbo diff --git a/src/sbin/lorax-composer b/src/sbin/lorax-composer index 41cba588..0cb65bc2 100755 --- a/src/sbin/lorax-composer +++ b/src/sbin/lorax-composer @@ -245,7 +245,11 @@ if __name__ == '__main__': make_dnf_dirs(server.config["COMPOSER_CFG"]) # Get a dnf.Base to share with the requests - dbo = get_base_object(server.config["COMPOSER_CFG"]) + try: + dbo = get_base_object(server.config["COMPOSER_CFG"]) + except RuntimeError: + # Error has already been logged. Just exit cleanly. + sys.exit(1) server.config["DNFLOCK"] = DNFLock(dbo=dbo, lock=Lock()) # Depsolve the templates and make a note of the failures for /api/status to report