From e425b7ccca9d32d4791038174552d97167b8fa1f Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 13 Mar 2018 15:16:12 -0700 Subject: [PATCH] lorax-composer: Update the yum metadata at startup Otherwise it can become out of date and depsolving will fail. --- src/pylorax/api/yumbase.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pylorax/api/yumbase.py b/src/pylorax/api/yumbase.py index 09ac3d85..972a07f4 100644 --- a/src/pylorax/api/yumbase.py +++ b/src/pylorax/api/yumbase.py @@ -22,7 +22,6 @@ log = logging.getLogger("lorax-composer") import ConfigParser from fnmatch import fnmatchcase from glob import glob -from distutils.util import strtobool import os import yum # This is a hack to short circuit yum's internal logging @@ -102,4 +101,13 @@ def get_base_object(conf): if any(map(lambda pattern: fnmatchcase(name, pattern), enabled_repos)): # pylint: disable=cell-var-from-loop yb.getReposFromConfigFile(repo_file) + # Update the metadata from the enabled repos to speed up later operations + log.info("Updating yum repository metadata") + for r in yb.repos.sort(): + r.metadata_expire = 0 + r.mdpolicy = "group:all" + yb.doRepoSetup() + yb.repos.doSetup() + yb.repos.populateSack(mdtype='all', cacheonly=1) + return yb