raise error if failed to install bootstrap
authorGui Chen <gui.chen@intel.com>
Tue, 26 Nov 2013 07:16:44 +0000 (02:16 -0500)
committerGui Chen <gui.chen@intel.com>
Wed, 4 Dec 2013 02:59:55 +0000 (21:59 -0500)
Fixes: #1467

Change-Id: I78d0a207d7902f0c2ae16b31dc33bc2c893da1f7
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/bootstrap.py

index 29e8655..d59b718 100644 (file)
@@ -135,7 +135,17 @@ class MiniBackend(object):
         # run transaction
         self.ts.order()
         cb = RPMInstallCallback(self.ts)
-        self.ts.run(cb.callback, '')
+        errors = self.ts.run(cb.callback, '')
+
+        # ts.run() exit codes are, hmm, "creative": None means all ok, empty 
+        # list means some errors happened in the transaction and non-empty 
+        # list that there were errors preventing the ts from starting...
+        if errors is None:
+            pass
+        elif len(errors) == 0:
+             msger.warning("Warning: scriptlet or other non-fatal errors occurred")
+        else:
+             raise errors.BootstrapError("Transaction couldn't start: %s" % '\n'.join(errors))
 
     def run_pkg_script(self, pkg, prog, script, arg):
         mychroot = lambda: os.chroot(self.rootdir)