rpm.setVerbosity(rpm.RPMLOG_DEBUG)\r
except ImportError:\r
pass\r
-\r
#check the imager type\r
createrClass = None\r
for subcmd, klass in pluginmgr.get_plugins('imager').iteritems():\r
\r
if args.skip_set_hosts:\r
configmgr.create['skip_set_hosts']=args.skip_set_hosts\r
-\r
+ if args.postscripts_maxruntime:\r
+ configmgr.create['postscripts_maxruntime']=int(args.postscripts_maxruntime)\r
if args.runtime:\r
configmgr.set_runtime(args.runtime)\r
\r
"tpk_install": None,
"use_mic_in_bootstrap": False,
"skip_set_hosts": False,
+ "postscripts_maxruntime": 120,
},
'chroot': {
"saveto": None,
from mic.archive import get_archive_suffixes
from mic.conf import configmgr
from mic.utils.grabber import myurlgrab
-#post script max run time
-MAX_RUN_TIME = 120
class BaseImageCreator(object):
"""Installs a system to a chroot directory.
else:
preexec = self._chroot
script = "/tmp/" + os.path.basename(path)
-
start_time = time.time()
try:
try:
while p.poll() == None:
msger.info(p.stdout.readline().strip())
end_time = time.time()
- if (end_time - start_time)/60 > MAX_RUN_TIME:
- raise CreatorError("Your post script is executed more than "+MAX_RUN_TIME+"mins, please check it!")
+ if (end_time - start_time)/60 > configmgr.create['postscripts_maxruntime']:
+ raise CreatorError("Your post script is executed more than %d mins, please check it!" % configmgr.create['postscripts_maxruntime'])
if p.returncode != 0:
raise CreatorError("Failed to execute %%post script "
"with '%s'" % (s.interp))
default=None, help='Copy tpk file to /usr/apps/.preload-tpk')
parent_parser.add_argument('--rpm-debug', action='store_true', dest='rpm_debug', help='Set debug mode for rpm install')
parent_parser.add_argument('--skip-set-hosts', action='store_true', dest='skip_set_hosts', default=False, help='choose to skip set hosts by mic')
+ parent_parser.add_argument('--postscripts-maxruntime', dest='postscripts_maxruntime', default=120, help='max run time for post scripts')
parser.set_defaults(alias="cr")