fix convert and chroot issue caused by not existed image
authorGui Chen <gui.chen@intel.com>
Tue, 27 Dec 2011 07:07:02 +0000 (15:07 +0800)
committerGui Chen <gui.chen@intel.com>
Tue, 27 Dec 2011 07:07:02 +0000 (15:07 +0800)
Signed-off-by: Gui Chen <gui.chen@intel.com>
tools/mic

index a331a32..dffb8a6 100755 (executable)
--- a/tools/mic
+++ b/tools/mic
@@ -101,6 +101,8 @@ class MicCmd(cmdln.Cmdln):
         else:
             raise errors.Usage("Extra argument given")
 
+        if not os.path.exists(srcimg):
+            raise errors.CreatorError("Failed to find the image: %s" % srcimg)
         self._root_confirm()
 
         srcformat = misc.get_image_type(srcimg)
@@ -143,6 +145,9 @@ class MicCmd(cmdln.Cmdln):
         else:
             raise errors.Usage("Extra argument given")
 
+        if not os.path.exists(targetimage):
+            raise errors.CreatorError("Failed to find the image: %s" 
+                                      % targetimage)
         self._root_confirm()
 
         imagetype = misc.get_image_type(targetimage)