more check for commit 9f5f5cfc38e735b7abcf9e11e0969fc4554ebcdc
authorGui Chen <gui.chen@intel.com>
Mon, 4 Nov 2013 05:48:05 +0000 (00:48 -0500)
committerGui Chen <gui.chen@intel.com>
Tue, 5 Nov 2013 02:28:29 +0000 (21:28 -0500)
Change-Id: Id61d09a4740719cb9ae1d5d167eaede63eb99ae9
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/imager/raw.py

index e00db84..40a4ac7 100644 (file)
@@ -234,6 +234,9 @@ class RawImageCreator(BaseImageCreator):
         def copy_devnode(src, dest):
             """A helper function for copying device nodes."""
 
+            if not src:
+                return
+
             stat_obj = os.stat(src)
             assert stat.S_ISBLK(stat_obj.st_mode)
 
@@ -265,9 +268,10 @@ class RawImageCreator(BaseImageCreator):
         """
 
         for p in self.__instloop.partitions:
-            path = self._instroot + p['mapper_device']
-            if os.path.exists(path):
-                os.unlink(path)
+            if p['mapper_device']:
+                path = self._instroot + p['mapper_device']
+                if os.path.exists(path):
+                    os.unlink(path)
 
         path = self._instroot + "/dev/mapper"
         if os.path.exists(path):