本文整理匯總了Python中bkr.server.model.Task.exists_by_name方法的典型用法代碼示例。如果您正苦於以下問題:Python Task.exists_by_name方法的具體用法?Python Task.exists_by_name怎麽用?Python Task.exists_by_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bkr.server.model.Task
的用法示例。
在下文中一共展示了Task.exists_by_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: hasattr
# 需要導入模塊: from bkr.server.model import Task [as 別名]
# 或者: from bkr.server.model.Task import exists_by_name [as 別名]
package = TaskPackage.lazy_create(package='%s' % xmlpackage.name)
recipe.custom_packages.append(package)
for installPackage in xmlrecipe.installPackages():
package = TaskPackage.lazy_create(package='%s' % installPackage)
recipe.custom_packages.append(package)
for xmlrepo in xmlrecipe.iter_repos():
recipe.repos.append(RecipeRepo(name=xmlrepo.name, url=xmlrepo.url))
for xmlksappend in xmlrecipe.iter_ksappends():
recipe.ks_appends.append(RecipeKSAppend(ks_append=xmlksappend))
xmltasks = []
invalid_tasks = []
for xmltask in xmlrecipe.iter_tasks():
if hasattr(xmltask, 'fetch'):
# If fetch URL is given, the task doesn't need to exist.
xmltasks.append(xmltask)
elif Task.exists_by_name(xmltask.name, valid=True):
xmltasks.append(xmltask)
else:
invalid_tasks.append(xmltask.name)
if invalid_tasks and not ignore_missing_tasks:
raise BX(_('Invalid task(s): %s') % ', '.join(invalid_tasks))
for xmltask in xmltasks:
if hasattr(xmltask, 'fetch'):
recipetask = RecipeTask.from_fetch_url(xmltask.fetch.url,
subdir=xmltask.fetch.subdir, name=xmltask.name)
else:
recipetask = RecipeTask.from_task(Task.by_name(xmltask.name))
recipetask.role = xmltask.role
for xmlparam in xmltask.iter_params():
param = RecipeTaskParam( name=xmlparam.name,
value=xmlparam.value)