當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。