fus: Support HTTP repos
Recent version of fus gained ability to download repodata if repo is provided as HTTP url. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
ce066707c1
commit
0207260b9f
@ -62,13 +62,9 @@ def write_config(conf_file, modules, packages):
|
||||
|
||||
|
||||
def _prep_path(path):
|
||||
"""Strip file:// from the path if present or raise exception for other
|
||||
protocols.
|
||||
"""
|
||||
if "://" in path:
|
||||
proto, path = path.split("://", 2)
|
||||
if proto != "file":
|
||||
raise ValueError("Only repositories on local filesystem are supported.")
|
||||
"""Strip file:// from the path if present."""
|
||||
if path.startswith("file://"):
|
||||
return path[len("file://"):]
|
||||
return path
|
||||
|
||||
|
||||
|
@ -63,9 +63,19 @@ class TestGetCmd(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
def test_fail_on_http_repo(self):
|
||||
with self.assertRaises(ValueError):
|
||||
fus.get_cmd("conf", "x86_64", ["http:///tmp"], [])
|
||||
def test_preserves_http_protocol(self):
|
||||
cmd = fus.get_cmd("conf", "x86_64", [], ["http://r"])
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
[
|
||||
"fus",
|
||||
"--verbose",
|
||||
"--arch",
|
||||
"x86_64",
|
||||
"--repo=lookaside-0,lookaside,http://r",
|
||||
"@conf",
|
||||
],
|
||||
)
|
||||
|
||||
def test_strip_file_protocol_lookaside(self):
|
||||
cmd = fus.get_cmd("conf", "x86_64", [], ["file:///r"])
|
||||
@ -81,9 +91,18 @@ class TestGetCmd(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
def test_fail_on_http_repo_lookaside(self):
|
||||
with self.assertRaises(ValueError):
|
||||
fus.get_cmd("conf", "x86_64", [], ["http:///tmp"])
|
||||
def test_preserves_http_protocol_lookaside(self):
|
||||
self.assertEqual(
|
||||
fus.get_cmd("conf", "x86_64", [], ["http:///tmp"]),
|
||||
[
|
||||
"fus",
|
||||
"--verbose",
|
||||
"--arch",
|
||||
"x86_64",
|
||||
"--repo=lookaside-0,lookaside,http:///tmp",
|
||||
"@conf",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class TestWriteConfig(PungiTestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user