Skip to content

Commit

Permalink
Catch errors when listing images
Browse files Browse the repository at this point in the history
Fix #764
  • Loading branch information
julien-duponchelle committed Nov 11, 2016
1 parent 4770912 commit 65090c6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions gns3server/compute/base_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,14 @@ def list_images(self):
for filename in files:
if filename[0] != "." and not filename.endswith(".md5sum"):
path = os.path.relpath(os.path.join(root, filename), img_dir)
images.append({
"filename": filename,
"path": path,
"md5sum": md5sum(os.path.join(root, filename)),
"filesize": os.stat(os.path.join(root, filename)).st_size})
try:
images.append({
"filename": filename,
"path": path,
"md5sum": md5sum(os.path.join(root, filename)),
"filesize": os.stat(os.path.join(root, filename)).st_size})
except OSError as e:
log.warn("Can't add image {}: {}".format(path, str(e)))
return images

def get_images_directory(self):
Expand Down

0 comments on commit 65090c6

Please sign in to comment.