if args.skip_set_hosts:
configmgr.create['skip_set_hosts']=args.skip_set_hosts
- if args.runtime:
+ if args.postscripts_maxruntime:
+ configmgr.create['postscripts_maxruntime']=int(args.postscripts_maxruntime)
+
+if args.runtime:
configmgr.set_runtime(args.runtime)
if args.use_mic_in_bootstrap:
"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):
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")