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


Python Release.create方法代码示例

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


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

示例1: create_release

# 需要导入模块: from nailgun.objects import Release [as 别名]
# 或者: from nailgun.objects.Release import create [as 别名]
 def create_release(self, api=False, **kwargs):
     version = kwargs.get(
         'version', '{0}-5.1'.format(randint(0, 100000000)))
     release_data = {
         'name': u"release_name_" + version,
         'version': version,
         'description': u"release_desc" + version,
         'operating_system': 'CentOS',
         'roles': self.get_default_roles(),
         'networks_metadata': self.get_default_networks_metadata(),
         'attributes_metadata': self.get_default_attributes_metadata(),
         'volumes_metadata': self.get_default_volumes_metadata()
     }
     if kwargs:
         release_data.update(kwargs)
     if api:
         resp = self.app.post(
             reverse('ReleaseCollectionHandler'),
             params=jsonutils.dumps(release_data),
             headers=self.default_headers
         )
         self.tester.assertEqual(resp.status_code, 201)
         release = resp.json_body
         self.releases.append(
             self.db.query(Release).get(release['id'])
         )
     else:
         release = Release.create(release_data)
         db().commit()
         self.releases.append(release)
     return release
开发者ID:slystopad,项目名称:fuel-web,代码行数:33,代码来源:base.py

示例2: create_release

# 需要导入模块: from nailgun.objects import Release [as 别名]
# 或者: from nailgun.objects.Release import create [as 别名]
    def create_release(self, api=False, **kwargs):
        os = kwargs.get("operating_system", consts.RELEASE_OS.centos)
        version = kwargs.get("version", "{0}-6.1".format(randint(0, 100000000)))

        # NOTE(ikalnitsky): In order to do not read each time openstack.yaml
        # we're reading it once and then look for needed release.
        releases = self.read_fixtures(("openstack",))
        release_data = next((r for r in releases if r["fields"]["operating_system"] == os), releases[0])
        release_data = release_data["fields"]

        release_data.update(
            {
                "name": u"release_name_" + version,
                "version": version,
                "description": u"release_desc" + version,
                "modes": ["ha_compact", "multinode"],
            }
        )

        if kwargs.get("deployment_tasks") is None:
            kwargs["deployment_tasks"] = load_fake_deployment_tasks(apply_to_db=False)

        release_data.update(kwargs)
        if api:
            resp = self.app.post(
                reverse("ReleaseCollectionHandler"), params=jsonutils.dumps(release_data), headers=self.default_headers
            )
            self.tester.assertEqual(resp.status_code, 201)
            release = resp.json_body
            self.releases.append(self.db.query(Release).get(release["id"]))
        else:
            release = Release.create(release_data)
            db().commit()
            self.releases.append(release)
        return release
开发者ID:thefuyang,项目名称:fuel-web,代码行数:37,代码来源:base.py

示例3: create_release

# 需要导入模块: from nailgun.objects import Release [as 别名]
# 或者: from nailgun.objects.Release import create [as 别名]
    def create_release(self, api=False, **kwargs):
        os = kwargs.get(
            'operating_system', consts.RELEASE_OS.centos)
        version = kwargs.get(
            'version', '{0}-6.1'.format(randint(0, 100000000)))

        # NOTE(ikalnitsky): In order to do not read each time openstack.yaml
        # we're reading it once and then look for needed release.
        releases = self.read_fixtures(('openstack',))
        release_data = next((
            r for r in releases if r['fields']['operating_system'] == os),
            releases[0])
        release_data = release_data['fields']

        release_data.update({
            'name': u"release_name_" + version,
            'version': version,
            'description': u"release_desc" + version,
            'roles': self.get_default_roles(),
            'modes': ['ha_compact', 'multinode'],
        })

        if kwargs.get('deployment_tasks') is None:
            kwargs['deployment_tasks'] = \
                load_fake_deployment_tasks(apply_to_db=False)

        release_data.update(kwargs)
        if api:
            resp = self.app.post(
                reverse('ReleaseCollectionHandler'),
                params=jsonutils.dumps(release_data),
                headers=self.default_headers
            )
            self.tester.assertEqual(resp.status_code, 201)
            release = resp.json_body
            self.releases.append(
                self.db.query(Release).get(release['id'])
            )
        else:
            release = Release.create(release_data)
            db().commit()
            self.releases.append(release)
        return release
开发者ID:blkart,项目名称:fuel-web,代码行数:45,代码来源:base.py


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