Reviewed-by: Daniel Barboza <danielhb(a)linux.vnet.ibm.com>
On 02/11/2014 03:39 PM, Rodrigo Trujillo wrote:
The module vmscreenshot is preventing this error using Image.load
function inside a try/except. However right after the except block,
the code calls Image.thumbnail() function, which calls the same
load() function internally. Then the error could happen again.
This patch fixes this possible problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/screenshot.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/kimchi/screenshot.py b/src/kimchi/screenshot.py
index 5cfea96..91c14a6 100644
--- a/src/kimchi/screenshot.py
+++ b/src/kimchi/screenshot.py
@@ -177,10 +177,9 @@ class VMScreenshot(object):
try:
# Prevent Image lib from lazy load,
# work around pic truncate validation in thumbnail generation
- im.load()
+ im.thumbnail(self.THUMBNAIL_SIZE)
except Exception as e:
kimchi_log.warning("Image load with warning: %s." % e)
- im.thumbnail(self.THUMBNAIL_SIZE)
im.save(thumbnail, "PNG")
self.info['thumbnail'] = thumbnail