mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Filter md5sum files from the list of images
This commit is contained in:
parent
2842904769
commit
7777407c4b
@ -40,7 +40,9 @@ def scan_for_images(type):
|
|||||||
for file in filenames:
|
for file in filenames:
|
||||||
path = os.path.join(root, file)
|
path = os.path.join(root, file)
|
||||||
if file not in files:
|
if file not in files:
|
||||||
if (file.endswith(".image") and type == "dynamips") \
|
if file.endswith(".md5sum"):
|
||||||
|
continue
|
||||||
|
elif (file.endswith(".image") and type == "dynamips") \
|
||||||
or (file.endswith(".bin") and type == "iou") \
|
or (file.endswith(".bin") and type == "iou") \
|
||||||
or (not file.endswith(".bin") and not file.endswith(".image") and type == "qemu"):
|
or (not file.endswith(".bin") and not file.endswith(".image") and type == "qemu"):
|
||||||
files.add(file)
|
files.add(file)
|
||||||
|
@ -109,6 +109,10 @@ def test_scan_for_images(tmpdir):
|
|||||||
path4.write("1", ensure=True)
|
path4.write("1", ensure=True)
|
||||||
path4 = force_unix_path(str(path4))
|
path4 = force_unix_path(str(path4))
|
||||||
|
|
||||||
|
path5 = tmpdir / "images1" / "QEMU" / "test4.qcow2.md5sum"
|
||||||
|
path5.write("1", ensure=True)
|
||||||
|
path5 = force_unix_path(str(path5))
|
||||||
|
|
||||||
with patch("gns3server.config.Config.get_section_config", return_value={
|
with patch("gns3server.config.Config.get_section_config", return_value={
|
||||||
"images_path": str(tmpdir / "images1"),
|
"images_path": str(tmpdir / "images1"),
|
||||||
"additional_images_path": "/tmp/null24564:{}".format(tmpdir / "images2"),
|
"additional_images_path": "/tmp/null24564:{}".format(tmpdir / "images2"),
|
||||||
|
Loading…
Reference in New Issue
Block a user