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