mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Qemu VMs: only compute MD5 checksums for existing disks
This commit is contained in:
5 files changed
+18
-18
No files matched your search
@@ -259,14 +259,15 @@ def md5sum(path, working_dir=None, stopped_event=None, cache_to_md5file=True):
|
||||
else:
|
||||
md5sum_file = path + ".md5sum"
|
||||
|
||||
try:
|
||||
with open(md5sum_file) as f:
|
||||
md5 = f.read().strip()
|
||||
if len(md5) == 32:
|
||||
return md5
|
||||
# Unicode error is when user rename an image to .md5sum ....
|
||||
except (OSError, UnicodeDecodeError):
|
||||
pass
|
||||
if os.path.exists(md5sum_file):
|
||||
try:
|
||||
with open(md5sum_file) as f:
|
||||
md5 = f.read().strip()
|
||||
if len(md5) == 32:
|
||||
return md5
|
||||
# Unicode error is when user rename an image to .md5sum ....
|
||||
except (OSError, UnicodeDecodeError):
|
||||
pass
|
||||
|
||||
try:
|
||||
m = hashlib.md5()
|
||||
|
||||
Reference in new issue
Block a user