diff --git a/src/sbin/lorax b/src/sbin/lorax index 1e087079..543cae20 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -229,10 +229,10 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[], tempdir="/var/tmp", proxy=None, excludepkgs=[]): def sanitize_repo(repo): + """Convert bare paths to file:/// URIs, and silently reject protocols unhandled by yum""" if repo.startswith("/"): return "file://{0}".format(repo) - elif (repo.startswith("http://") or repo.startswith("ftp://") - or repo.startswith("file://")): + elif any(repo.startswith(p) for p in ('http://', 'https://', 'ftp://', 'file://')): return repo else: return None