diff --git a/src/pylorax/api/compose.py b/src/pylorax/api/compose.py index 2cc10e54..25ad0da0 100644 --- a/src/pylorax/api/compose.py +++ b/src/pylorax/api/compose.py @@ -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: diff --git a/src/pylorax/api/queue.py b/src/pylorax/api/queue.py index f22f0209..ecea6d17 100644 --- a/src/pylorax/api/queue.py +++ b/src/pylorax/api/queue.py @@ -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