本文整理匯總了Python中bkr.server.model.Task.path方法的典型用法代碼示例。如果您正苦於以下問題:Python Task.path方法的具體用法?Python Task.path怎麽用?Python Task.path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bkr.server.model.Task
的用法示例。
在下文中一共展示了Task.path方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_task
# 需要導入模塊: from bkr.server.model import Task [as 別名]
# 或者: from bkr.server.model.Task import path [as 別名]
def create_task(name=None, exclude_arches=None, exclusive_arches=None,
exclude_osmajors=None, exclusive_osmajors=None, version=u'1.0-1',
uploader=None, owner=None, priority=u'Manual', valid=None, path=None,
description=None, requires=None, runfor=None, type=None, avg_time=1200):
if name is None:
name = unique_name(u'/distribution/test_task_%s')
if path is None:
path = u'/mnt/tests/%s' % name
if description is None:
description = unique_name(u'description%s')
if uploader is None:
uploader = create_user(user_name=u'task-uploader%s' % name.replace('/', '-'))
if owner is None:
owner = u'task-owner%[email protected]' % name.replace('/', '-')
if valid is None:
valid = True
rpm = u'example%s-%s.noarch.rpm' % (name.replace('/', '-'), version)
task = Task(name=name)
task.rpm = rpm
task.version = version
task.uploader = uploader
task.owner = owner
task.priority = priority
task.valid = valid
task.path = path
task.description = description
task.avg_time = avg_time
task.license = u'GPLv99+'
if type:
for t in type:
task.types.append(TaskType.lazy_create(type=t))
if exclude_arches:
for arch in exclude_arches:
task.excluded_arches.append(Arch.by_name(arch))
if exclusive_arches:
for arch in exclusive_arches:
task.exclusive_arches.append(Arch.by_name(arch))
if exclude_osmajors:
for osmajor in exclude_osmajors:
task.excluded_osmajors.append(OSMajor.lazy_create(osmajor=osmajor))
if exclusive_osmajors:
for osmajor in exclusive_osmajors:
task.exclusive_osmajors.append(OSMajor.lazy_create(osmajor=osmajor))
if requires:
for require in requires:
tp = TaskPackage.lazy_create(package=require)
task.required.append(tp)
if runfor:
for run in runfor:
task.runfor.append(TaskPackage.lazy_create(package=run))
session.add(task)
session.flush()
log.debug('Created task %s', task.name)
return task