本文整理汇总了Python中bkr.server.model.Job.provision_system_job方法的典型用法代码示例。如果您正苦于以下问题:Python Job.provision_system_job方法的具体用法?Python Job.provision_system_job怎么用?Python Job.provision_system_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.Job
的用法示例。
在下文中一共展示了Job.provision_system_job方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doit
# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import provision_system_job [as 别名]
def doit():
distro_trees = []
for id in request.form.getlist('distro_tree_id'):
try:
distro_trees.append(DistroTree.by_id(id))
except NoResultFound:
raise BadRequest400('Distro tree %r does not exist' % id)
job_details = {}
job_details['pick'] = request.form.get('pick') or 'auto'
if job_details['pick'] == 'fqdn':
try:
job_details['system'] = System.by_fqdn(request.form.get('system'),
identity.current.user)
except NoResultFound:
raise BadRequest400('System %s not found' % request.form.get('system'))
elif job_details['pick'] == 'lab':
try:
job_details['lab'] = LabController.by_name(request.form.get('lab'))
except NoResultFound:
raise BadRequest400('Lab controller %s not found' % request.form.get('lab'))
days = int(request.form.get('reserve_days') or DEFAULT_RESERVE_DAYS)
days = min(days, MAX_DAYS_PROVISION)
job_details['reservetime'] = days * 24 * 60 * 60
job_details['whiteboard'] = request.form.get('whiteboard')
job_details['ks_meta'] = request.form.get('ks_meta')
job_details['koptions'] = request.form.get('koptions')
job_details['koptions_post'] = request.form.get('koptions_post')
with convert_internal_errors():
job = Job.provision_system_job(distro_trees, **job_details)
return 'Created %s' % job.t_id, 201, [('Location', absolute_url('/jobs/%s' % job.id))]
示例2: doit
# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import provision_system_job [as 别名]
def doit(self, distro_tree_id, **kw):
""" Create a new reserve job, if system_id is defined schedule it too """
if 'system_id' in kw:
kw['id'] = kw['system_id']
try:
provision_system_job = Job.provision_system_job(distro_tree_id, **kw)
except BX, msg:
flash(_(u"%s" % msg))
redirect(u".")