lorax-composer: Update the yum metadata at startup
Otherwise it can become out of date and depsolving will fail.
This commit is contained in:
parent
2e61bc8bf9
commit
e425b7ccca
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user