From 21e9247b403b8b98e10ac6f2d1b1b40d71ef290e Mon Sep 17 00:00:00 2001 From: Gui Chen Date: Tue, 5 Aug 2014 03:01:31 -0400 Subject: [PATCH] add strict-mode feature for zypp backend Fixes: #2056 Change-Id: I4858a52364189d5985c90b4bc6a0d435507be758 Signed-off-by: Gui Chen --- mic/creator.py | 2 +- plugins/backend/zypppkgmgr.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mic/creator.py b/mic/creator.py index be4773b..0052ceb 100644 --- a/mic/creator.py +++ b/mic/creator.py @@ -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. ') diff --git a/plugins/backend/zypppkgmgr.py b/plugins/backend/zypppkgmgr.py index 4a41bea..3590edc 100644 --- a/plugins/backend/zypppkgmgr.py +++ b/plugins/backend/zypppkgmgr.py @@ -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]) -- 2.7.4