mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-19 06:48:10 +00:00
parent
46e5e8ac68
commit
c96694105c
@ -71,10 +71,15 @@ class Controller:
|
||||
):
|
||||
if os.path.isdir(directory):
|
||||
for file in os.listdir(directory):
|
||||
if not file.endswith('.gns3a') and not file.endswith('.gns3appliance'):
|
||||
continue
|
||||
path = os.path.join(directory, file)
|
||||
appliance_id = uuid.uuid3(uuid.NAMESPACE_URL, path) # Generate the UUID from path to avoid change between reboots
|
||||
try:
|
||||
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':
|
||||
self._appliance_templates[appliance.id] = appliance
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user