Exemple #1
0
 def create_release(self, api=False, **kwargs):
     version = str(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=json.dumps(release_data),
                              headers=self.default_headers)
         self.tester.assertEquals(resp.status_code, 201)
         release = json.loads(resp.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
Exemple #2
0
    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
Exemple #3
0
 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
Exemple #4
0
    def create_release(self, api=False, **kwargs):
        os = kwargs.get('operating_system', consts.RELEASE_OS.centos)
        version = kwargs.get('version', '{0}-5.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(),
        })

        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
Exemple #5
0
 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,
         'state': consts.RELEASE_STATES.available,
         '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(),
         'roles_metadata': self.get_default_roles_metadata(),
         'orchestrator_data': self.get_default_orchestrator_data(),
     }
     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
Exemple #6
0
    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