mirror of
https://github.com/GNS3/gns3-server
synced 2025-05-21 16:28:54 +00:00
parent
46e5e8ac68
commit
c96694105c
@ -71,10 +71,15 @@ class Controller:
|
|||||||
):
|
):
|
||||||
if os.path.isdir(directory):
|
if os.path.isdir(directory):
|
||||||
for file in os.listdir(directory):
|
for file in os.listdir(directory):
|
||||||
|
if not file.endswith('.gns3a') and not file.endswith('.gns3appliance'):
|
||||||
|
continue
|
||||||
path = os.path.join(directory, file)
|
path = os.path.join(directory, file)
|
||||||
appliance_id = uuid.uuid3(uuid.NAMESPACE_URL, path) # Generate the UUID from path to avoid change between reboots
|
appliance_id = uuid.uuid3(uuid.NAMESPACE_URL, path) # Generate the UUID from path to avoid change between reboots
|
||||||
with open(path, 'r', encoding='utf-8') as f:
|
try:
|
||||||
appliance = ApplianceTemplate(appliance_id, json.load(f), builtin=builtin)
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
|
appliance = ApplianceTemplate(appliance_id, json.load(f), builtin=builtin)
|
||||||
|
except (ValueError, OSError) as e:
|
||||||
|
log.warning("Can't load %s: %s", path, str(e))
|
||||||
if appliance.status != 'broken':
|
if appliance.status != 'broken':
|
||||||
self._appliance_templates[appliance.id] = appliance
|
self._appliance_templates[appliance.id] = appliance
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user