https is a sane package source URL scheme

Add https as a URL source and use list comprehension to check the
supported protocols.
This commit is contained in:
Colin Walters 2014-07-31 17:10:19 -04:00 committed by Brian C. Lane
parent 831a3d7684
commit 611cef1823
1 changed files with 2 additions and 2 deletions

View File

@ -214,10 +214,10 @@ def get_yum_base_object(installroot, repositories, mirrorlists=None,
tempdir="/var/tmp", proxy=None, excludepkgs=None):
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