mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-20 05:17:55 +00:00
Support devices stored in sub directories
This commit is contained in:
parent
10cd2861d3
commit
78542eee40
@ -37,7 +37,9 @@ class Repository:
|
|||||||
|
|
||||||
#TODO: Manage open error
|
#TODO: Manage open error
|
||||||
devices_path = self._get_devices_path()
|
devices_path = self._get_devices_path()
|
||||||
for file in os.listdir(devices_path):
|
for (dirpath, dirnames, filenames) in os.walk(devices_path):
|
||||||
|
for filename in filenames:
|
||||||
|
file = os.path.join(dirpath, filename)
|
||||||
with open(os.path.join(devices_path, file)) as f:
|
with open(os.path.join(devices_path, file)) as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
if self._image_match(image, config):
|
if self._image_match(image, config):
|
||||||
|
@ -76,7 +76,7 @@ def empty_config(tmpdir):
|
|||||||
|
|
||||||
|
|
||||||
def test_add_image(empty_config, linux_microcore_img):
|
def test_add_image(empty_config, linux_microcore_img):
|
||||||
with open("devices/microcore-linux.json") as f:
|
with open("devices/qemu/microcore-linux.json") as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
image = Image(linux_microcore_img)
|
image = Image(linux_microcore_img)
|
||||||
image.version = "3.4.1"
|
image.version = "3.4.1"
|
||||||
@ -107,7 +107,7 @@ def test_add_image(empty_config, linux_microcore_img):
|
|||||||
|
|
||||||
|
|
||||||
def test_add_image_uniq(empty_config, linux_microcore_img):
|
def test_add_image_uniq(empty_config, linux_microcore_img):
|
||||||
with open("devices/microcore-linux.json") as f:
|
with open("devices/qemu/microcore-linux.json") as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
image = Image(linux_microcore_img)
|
image = Image(linux_microcore_img)
|
||||||
image.version = "3.4.1"
|
image.version = "3.4.1"
|
||||||
@ -120,7 +120,7 @@ def test_add_image_uniq(empty_config, linux_microcore_img):
|
|||||||
|
|
||||||
def test_save(empty_config, linux_microcore_img):
|
def test_save(empty_config, linux_microcore_img):
|
||||||
|
|
||||||
with open("devices/microcore-linux.json") as f:
|
with open("devices/qemu/microcore-linux.json") as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
empty_config.add_image(config)
|
empty_config.add_image(config)
|
||||||
empty_config.save()
|
empty_config.save()
|
||||||
|
@ -25,7 +25,7 @@ from gns3repository.repository import Repository
|
|||||||
|
|
||||||
def test_detect_image(linux_microcore_img):
|
def test_detect_image(linux_microcore_img):
|
||||||
|
|
||||||
with open("devices/microcore-linux.json") as f:
|
with open("devices/qemu/microcore-linux.json") as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
|
||||||
repository = Repository()
|
repository = Repository()
|
||||||
|
Loading…
Reference in New Issue
Block a user