Beispiel #1
0
    def _add_base_repos_to_releases(self, releases, existing_releases):
        """Update given releases with orchestrator data of base release.

        :param releases: a list of releases to process
        :param existing_releases: a list of existings releases
        """
        metadata_path = self.config.openstack['metadata']

        # do nothing in case of metadata.yaml absence - just assume
        # that we have full repos
        if not os.path.exists(metadata_path):
            return

        with io.open(metadata_path, 'r', encoding='utf-8') as f:
            metadata = yaml.load(f) or {}

        # keep diff-based releases
        releases = filter(
            lambda r: r['version'] in metadata.get('diff_releases', {}),
            releases)

        # inject repos from base releases
        for release in releases:
            version = release['version']
            base_release = utils.get_base_release(
                release, metadata['diff_releases'][version], existing_releases)

            if base_release is None:
                raise errors.BaseReleaseNotFound(
                    'Could not find a base release - "{0}" - of the '
                    'release "{1}".'.format(
                        metadata['diff_releases'][version], version))

            release['orchestrator_data']['repo_metadata'].update(
                base_release['orchestrator_data']['repo_metadata'])
Beispiel #2
0
    def test_series_not_above_current_version(self):
        base = utils.get_base_release({
            'operating_system': 'centos',
            'version': '2014.1.1-5.0.1',
        }, '2014.1.1-5.0', self.existing_releases)

        self.assertIsNone(base)
Beispiel #3
0
    def test_not_found(self):
        base = utils.get_base_release({
            'operating_system': 'centos',
            'version': '2014.1.1-6.1',
        }, '2014.1.1-6.0', self.existing_releases)

        self.assertIsNone(base)
Beispiel #4
0
    def _add_base_repos_to_releases(self, releases, existing_releases):
        """Update given releases with orchestrator data of base release.

        :param releases: a list of releases to process
        :param existing_releases: a list of existings releases
        """
        metadata_path = self.config.openstack['metadata']

        # do nothing in case of metadata.yaml absence - just assume
        # that we have full repos
        if not os.path.exists(metadata_path):
            return

        with io.open(metadata_path, 'r', encoding='utf-8') as f:
            metadata = yaml.load(f) or {}

        # keep diff-based releases
        releases = filter(
            lambda r: r['version'] in metadata.get('diff_releases', {}),
            releases)

        # inject repos from base releases
        for release in releases:
            version = release['version']
            base_release = utils.get_base_release(
                release, metadata['diff_releases'][version], existing_releases)

            if base_release is None:
                raise errors.BaseReleaseNotFound(
                    'Could not find a base release - "{0}" - of the '
                    'release "{1}".'.format(metadata['diff_releases'][version],
                                            version))

            release['orchestrator_data']['repo_metadata'].update(
                base_release['orchestrator_data']['repo_metadata'])
Beispiel #5
0
    def test_series_found(self):
        base = utils.get_base_release({
            'operating_system': 'centos',
            'version': '2014.1.1-5.0.3',
        }, '2014.1.1-5.0', self.existing_releases)

        self.assertEqual(base['name'], 'Test C')
        self.assertEqual(base['version'], '2014.1.1-5.0.2')
Beispiel #6
0
    def test_exact_found(self):
        base = utils.get_base_release({
            'operating_system': 'ubuntu',
            'version': '2014.1.1-6.0',
        }, '2014.1.1-5.1', self.existing_releases)

        self.assertEqual(base['name'], 'Test B')
        self.assertEqual(base['version'], '2014.1.1-5.1')