"runtime": "bootstrap",
"extrarepos": {},
"ignore_ksrepo": False,
+ "strict_mode": False,
},
'chroot': {
"saveto": None,
optparser.add_option('', '--ignore-ksrepo', action='store_true',
dest='ignore_ksrepo', default=False,
help=SUPPRESS_HELP)
+ 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. ')
return optparser
def preoptparse(self, argv):
configmgr.create['record_pkgs'].append(infotype)
+ if self.options.strict_mode:
+ configmgr.create['strict_mode'] = self.options.strict_mode
if self.options.arch is not None:
supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
if self.options.arch in supported_arch:
self.destdir = "."
self.installerfw_prefix = "INSTALLERFW_"
self.target_arch = "noarch"
+ self.strict_mode = False
self._local_pkgs_path = None
self.pack_to = None
self.repourl = {}
"arch" : "target_arch",
"local_pkgs_path" : "_local_pkgs_path",
"copy_kernel" : "_need_copy_kernel",
+ "strict_mode" : "strict_mode",
}
# update setting from createopts
def get_pkg_manager(self):
return self.pkgmgr(target_arch = self.target_arch,
instroot = self._instroot,
- cachedir = self.cachedir)
+ cachedir = self.cachedir,
+ strict_mode = self.strict_mode)
def create_manifest(self):
def get_pack_suffix():
class Yum(BackendPlugin, yum.YumBase):
name = 'yum'
- def __init__(self, target_arch, instroot, cachedir):
+ def __init__(self, target_arch, instroot, cachedir, strict_mode = False):
yum.YumBase.__init__(self)
self.cachedir = cachedir
self.instroot = instroot
self.target_arch = target_arch
+ self.strict_mode = strict_mode
if self.target_arch:
if not rpmUtils.arch.arches.has_key(self.target_arch):
installlogfile = "%s/__catched_stderr.buf" % (self.instroot)
msger.enable_logstderr(installlogfile)
- self.runTransaction(cb)
+ transactionResult = self.runTransaction(cb)
+ if transactionResult.return_code != 0 and self.strict_mode:
+ raise CreatorError("mic failes to install some packages")
self._cleanupRpmdbLocks(self.conf.installroot)
except rpmUtils.RpmUtilsError, e:
class Zypp(BackendPlugin):
name = 'zypp'
- def __init__(self, target_arch, instroot, cachedir):
+ #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