Fix a problem with using a mirror as the primary url
Because of how Anaconda is run it needs to be passed a baseurl (using --repo on the anaconda cmdline), not a mirrorlist url. This fixes it so that the first mirror is used if the main repository is using a mirrorlist.
This commit is contained in:
parent
a1427b1a31
commit
c399447b81
@ -52,7 +52,15 @@ def repo_to_ks(r, url="url"):
|
||||
Set url to "baseurl" if it is a repo, leave it as "url" for the installation url.
|
||||
"""
|
||||
cmd = ""
|
||||
if r.metalink:
|
||||
if url == "url":
|
||||
if not r.urls:
|
||||
raise RuntimeError("Cannot find a base url for %s" % r.name)
|
||||
|
||||
# url is passed to Anaconda on the cmdline with --repo, so it cannot support a mirror
|
||||
# If a mirror is setup yum will return the list of mirrors in .urls
|
||||
# So just use the first one.
|
||||
cmd += '--%s="%s" ' % (url, r.urls[0])
|
||||
elif r.metalink:
|
||||
# XXX Total Hack
|
||||
# RHEL7 kickstart doesn't support metalink. If the url has 'metalink' in it, rewrite it as 'mirrorlist'
|
||||
if "metalink" in r.metalink:
|
||||
|
@ -142,6 +142,10 @@ def make_compose(cfg, results_dir):
|
||||
ks_version = makeVersion(RHEL7)
|
||||
ks = KickstartParser(ks_version, errorsAreFatal=False, missingIncludeIsFatal=False)
|
||||
ks.readKickstart(ks_path)
|
||||
# anaconda can only handle a url, it cannot use a mirrorlist or metalink for the primary repository.
|
||||
if not ks.handler.method.url:
|
||||
raise RuntimeError("The kickstart is missing a valid url line")
|
||||
|
||||
repo_url = ks.handler.method.url
|
||||
|
||||
# Load the compose configuration
|
||||
|
Loading…
Reference in New Issue
Block a user