check scriptlet error file on /tmp/.postscript/error/
authorjianzhong.fang <jz.fang@samsung.com>
Thu, 17 Mar 2016 02:34:48 +0000 (10:34 +0800)
committerSoonKyu Park <sk7.park@samsung.com>
Sat, 11 Jun 2016 11:38:51 +0000 (20:38 +0900)
Change-Id: I26c09e1bfc2c7ef9090b8e9218ce06880072398a

mic/imager/baseimager.py

index 38a72db..f1bac6f 100644 (file)
@@ -1013,6 +1013,18 @@ class BaseImageCreator(object):
                      the kickstart to be overridden.
 
         """
+        def checkScriptletError(dirname, suffix):
+            if os.path.exists(dirname):
+                list = os.listdir(dirname)
+                for line in list:
+                    filepath = os.path.join(dirname, line)
+                    if os.path.isfile(filepath) and 0 < line.find(suffix):
+                        return True
+                    else:
+                        continue
+             
+            return False
+            
         def get_ssl_verify(ssl_verify=None):
             if ssl_verify is not None:
                 return not ssl_verify.lower().strip() == 'no'
@@ -1093,6 +1105,9 @@ class BaseImageCreator(object):
         finally:
             pkg_manager.close()
 
+        if checkScriptletError(self._instroot + "/tmp/.postscript/error/", "_error"):
+            raise CreatorError('scriptlet errors occurred')
+            
         # hook post install
         self.postinstall()