add strict-mode feature for zypp backend
authorGui Chen <gui.chen@intel.com>
Tue, 5 Aug 2014 07:01:31 +0000 (03:01 -0400)
committerGui Chen <gui.chen@intel.com>
Tue, 5 Aug 2014 07:01:31 +0000 (03:01 -0400)
Fixes: #2056

Change-Id: I4858a52364189d5985c90b4bc6a0d435507be758
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/creator.py
plugins/backend/zypppkgmgr.py

index be4773b..0052ceb 100644 (file)
@@ -129,7 +129,7 @@ class Creator(cmdln.Cmdln):
         optparser.add_option('', '--ignore-ksrepo', action='store_true',
                              dest='ignore_ksrepo', default=False,
                              help=SUPPRESS_HELP)
-        optparser.add_option('', '--strict_mode', action='store_true',
+        optparser.add_option('', '--strict-mode', action='store_true',
                              dest='strict_mode', default=False,
                              help='Abort creation of image, if there are some errors'
                                   ' during rpm installation. ')
index 4a41bea..3590edc 100644 (file)
@@ -54,11 +54,11 @@ from mic.pluginbase import BackendPlugin
 class Zypp(BackendPlugin):
     name = 'zypp'
 
-    #strict_mode not used in zypp yet(yum only)
     def __init__(self, target_arch, instroot, cachedir, strict_mode = False):
         self.cachedir = cachedir
         self.instroot  = instroot
         self.target_arch = target_arch
+        self.strict_mode = strict_mode
 
         self.__pkgs_license = {}
         self.__pkgs_content = {}
@@ -874,7 +874,8 @@ class Zypp(BackendPlugin):
                 if len(errors) == 0:
                     msger.warning('scriptlet or other non-fatal errors occurred '
                                   'during transaction.')
-
+                    if self.strict_mode:
+                        raise CreatorError("mic failes to install some packages")
                 else:
                     for e in errors:
                         msger.warning(e[0])