当前位置: 首页>>代码示例>>Python>>正文


Python Job.inventory_system_job方法代码示例

本文整理汇总了Python中bkr.server.model.Job.inventory_system_job方法的典型用法代码示例。如果您正苦于以下问题:Python Job.inventory_system_job方法的具体用法?Python Job.inventory_system_job怎么用?Python Job.inventory_system_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bkr.server.model.Job的用法示例。


在下文中一共展示了Job.inventory_system_job方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_system_with_running_hardware_scan_recipe

# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import inventory_system_job [as 别名]
 def test_get_system_with_running_hardware_scan_recipe(self):
     # The bug was a circular reference from system -> recipe -> system
     # which caused JSON serialization to fail.
     with session.begin():
         Job.inventory_system_job(data_setup.create_distro_tree(), owner=self.owner, system=self.system)
         recipe = self.system.find_current_hardware_scan_recipe()
         data_setup.mark_recipe_running(recipe, system=self.system)
     response = requests.get(
         get_server_base() + "/systems/%s/" % self.system.fqdn, headers={"Accept": "application/json"}
     )
     response.raise_for_status()
     in_progress_scan = response.json()["in_progress_scan"]
     self.assertEquals(in_progress_scan["recipe_id"], recipe.id)
     self.assertEquals(in_progress_scan["status"], u"Running")
     self.assertEquals(in_progress_scan["job_id"], recipe.recipeset.job.t_id)
开发者ID:beaker-project,项目名称:beaker,代码行数:17,代码来源:test_systems.py

示例2: submit_inventory_job

# 需要导入模块: from bkr.server.model import Job [as 别名]
# 或者: from bkr.server.model.Job import inventory_system_job [as 别名]
def submit_inventory_job():
    """
    Submit a inventory job with the most suitable distro selected automatically.

    Returns a dictionary consisting of the job_id, recipe_id, status (recipe status) 
    and the job XML. If ``dryrun`` is set to ``True`` in the request, the first three 
    are set to ``None``.

    :jsonparam string fqdn: Fully-qualified domain name for the system.
    :jsonparam bool dryrun: If True, do not submit the job
    """
    if 'fqdn' not in request.json:
        raise BadRequest400('Missing the fqdn parameter')
    fqdn = request.json['fqdn']
    if 'dryrun' in request.json:
        dryrun = request.json['dryrun']
    else:
        dryrun = False
    try:
        system = System.by_fqdn(fqdn, identity.current.user)
    except NoResultFound:
        raise BadRequest400('System not found: %s' % fqdn)
    if system.find_current_hardware_scan_recipe():
        raise Conflict409('Hardware scanning already in progress')
    distro = system.distro_tree_for_inventory()
    if not distro:
        raise BadRequest400('Could not find a compatible distro for hardware scanning available to this system')
    job_details = {}
    job_details['system'] = system
    job_details['whiteboard'] = 'Update Inventory for %s' % fqdn
    with convert_internal_errors():
        job_xml = Job.inventory_system_job(distro, dryrun=dryrun, **job_details)
    r = {}
    if not dryrun:
        r = system.find_current_hardware_scan_recipe().__json__()
    else:
        r = {'recipe_id': None,
             'status': None,
             'job_id': None,
        }
    r['job_xml'] = job_xml
    r = jsonify(r)
    return r
开发者ID:ShaolongHu,项目名称:beaker,代码行数:45,代码来源:jobs.py


注:本文中的bkr.server.model.Job.inventory_system_job方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。