From 65090c6f870fe779579fa4bc46fa1616f696c477 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 11 Nov 2016 11:24:41 +0100 Subject: [PATCH] Catch errors when listing images Fix #764 --- gns3server/compute/base_manager.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gns3server/compute/base_manager.py b/gns3server/compute/base_manager.py index 5d9ec9a5..db10d5b2 100644 --- a/gns3server/compute/base_manager.py +++ b/gns3server/compute/base_manager.py @@ -483,11 +483,14 @@ class BaseManager: 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):