From f3dbb9d27d44cf94267403b89b9ba5a65a12dbd7 Mon Sep 17 00:00:00 2001 From: Gui Chen Date: Mon, 9 Jan 2012 17:38:37 +0800 Subject: [PATCH] more accurate checking for tarball of loop images Signed-off-by: Gui Chen --- plugins/imager/loop_plugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/imager/loop_plugin.py b/plugins/imager/loop_plugin.py index 649152c..c84efe6 100644 --- a/plugins/imager/loop_plugin.py +++ b/plugins/imager/loop_plugin.py @@ -183,10 +183,13 @@ class LoopPlugin(ImagerPlugin): @classmethod def do_chroot(cls, target): - import tarfile - if tarfile.is_tarfile(target): - LoopPlugin._do_chroot_tar(target) - return + if target.endswith('.tar'): + import tarfile + if tarfile.is_tarfile(target): + LoopPlugin._do_chroot_tar(target) + return + else: + raise errors.CreatorError("damaged tarball for loop images") img = target imgsize = misc.get_file_size(img) * 1024L * 1024L -- 2.7.4