mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-27 08:21:24 +00:00
parent
373113545f
commit
3fc64bced2
@ -710,10 +710,12 @@ class Dynamips(BaseManager):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
image_dir = self.get_images_directory()
|
image_dir = self.get_images_directory()
|
||||||
|
if not os.path.exists(image_dir):
|
||||||
|
return []
|
||||||
try:
|
try:
|
||||||
files = os.listdir(image_dir)
|
files = os.listdir(image_dir)
|
||||||
except FileNotFoundError:
|
except OSError as e:
|
||||||
return []
|
raise DynamipsError("Can not list {}: {}".format(image_dir, str(e)))
|
||||||
files.sort()
|
files.sort()
|
||||||
images = []
|
images = []
|
||||||
for filename in files:
|
for filename in files:
|
||||||
@ -724,7 +726,6 @@ class Dynamips(BaseManager):
|
|||||||
# read the first 7 bytes of the file.
|
# read the first 7 bytes of the file.
|
||||||
elf_header_start = f.read(7)
|
elf_header_start = f.read(7)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(e)
|
|
||||||
continue
|
continue
|
||||||
# valid IOS images must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1
|
# valid IOS images must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1
|
||||||
if elf_header_start == b'\x7fELF\x01\x02\x01':
|
if elf_header_start == b'\x7fELF\x01\x02\x01':
|
||||||
|
Loading…
Reference in New Issue
Block a user