def test_load_fixture(self):
        fixture = StringIO.StringIO('''
        - &base
          fields:
            a: 1
            b: 2
            c: 3

        - pk: 1
          extend: *base
          fields:
            a: 13

        - pk: 2
          extend: *base
          fields:
            d: 42
        ''')
        setattr(fixture, 'name', 'some.yaml')

        result = utils.load_fixture(fixture)
        self.assertEqual(len(result), 2)
        self.assertEqual(result[0], {
            'a': 13,
            'b': 2,
            'c': 3,
        })
        self.assertEqual(result[1], {
            'a': 1,
            'b': 2,
            'c': 3,
            'd': 42,
        })
示例#2
0
    def _read_releases(self):
        """Returns a list of releases in a dict representation.
        """
        releases = []

        # read releases from a set of files
        for release_yaml in glob.glob(self.config.openstack['releases']):
            with io.open(release_yaml, 'r', encoding='utf-8') as f:
                releases.extend(utils.load_fixture(f))

        # inject orchestrator_data into releases if empty
        for release in releases:
            meta = {
                'version': release['version'],
                'master_ip': self.config.astute['ADMIN_NETWORK']['ipaddress']}

            if 'ubuntu' == release['operating_system'].lower():
                repo = 'http://{master_ip}:8080/{version}/ubuntu/x86_64 ' \
                       'precise main'
            else:
                repo = 'http://{master_ip}:8080/{version}/centos/x86_64'

            release['orchestrator_data'] = {
                'puppet_manifests_source': (
                    'rsync://{master_ip}:/puppet/{version}/manifests/'.format(
                        **meta)),
                'puppet_modules_source': (
                    'rsync://{master_ip}:/puppet/{version}/modules/'.format(
                        **meta)),
                'repo_metadata': {
                    'nailgun': repo.format(**meta)}}

        return releases
示例#3
0
    def test_load_fixture(self):
        fixture = StringIO.StringIO('''
        - &base
          fields:
            a: 1
            b: 2
            c: 3

        - pk: 1
          extend: *base
          fields:
            a: 13

        - pk: 2
          extend: *base
          fields:
            d: 42
        ''')
        setattr(fixture, 'name', 'some.yaml')

        result = utils.load_fixture(fixture)
        self.assertEqual(len(result), 2)
        self.assertEqual(result[0], {
            'a': 13,
            'b': 2,
            'c': 3,
        })
        self.assertEqual(result[1], {
            'a': 1,
            'b': 2,
            'c': 3,
            'd': 42,
        })
示例#4
0
    def __init__(self, *args, **kwargs):
        super(OpenStackUpgrader, self).__init__(*args, **kwargs)

        #: a dictionary with meta information that could be used to
        #: format some data (paths, for example)
        self._meta = {
            'version': self.config.new_version,
            'master_ip': self.config.astute['ADMIN_NETWORK']['ipaddress'],
        }

        releases_yaml = self.config.openstack['releases']

        with io.open(releases_yaml, 'r', encoding='utf-8') as f:
            #: an array with releases information
            self.releases = utils.load_fixture(f)

        #: a nailgun object - api wrapper
        self.nailgun = NailgunClient(
            self.config.endpoints['nailgun']['host'],
            self.config.endpoints['nailgun']['port'],
        )

        self._update_conf()
        self._reset_state()

        #: an action manager that is used to install puppets/repos
        self.action_manager = ActionManager(self.config.openstack['actions'])
示例#5
0
    def __init__(self, *args, **kwargs):
        super(OpenStackUpgrader, self).__init__(*args, **kwargs)

        #: a dictionary with meta information that could be used to
        #: format some data (paths, for example)
        self._meta = {
            'version': self.config.new_version,
            'master_ip': self.config.astute['ADMIN_NETWORK']['ipaddress'],
        }

        releases_yaml = self.config.openstack['releases']

        with io.open(releases_yaml, 'r', encoding='utf-8') as f:
            #: an array with releases information
            self.releases = utils.load_fixture(f)

        #: a nailgun object - api wrapper
        self.nailgun = NailgunClient(
            self.config.endpoints['nginx_nailgun']['host'],
            self.config.endpoints['nginx_nailgun']['port'],
        )

        self._update_conf()
        self._reset_state()

        #: an action manager that is used to install puppets/repos
        self.action_manager = ActionManager(self.config.openstack['actions'])
示例#6
0
    def _read_releases(self):
        """Returns a list of releases in a dict representation."""
        releases = []

        # read releases from a set of files
        for release_yaml in glob.glob(self.config.openstack['releases']):
            with io.open(release_yaml, 'r', encoding='utf-8') as f:
                releases.extend(utils.load_fixture(f))

        return releases
示例#7
0
    def _read_releases(self):
        """Returns a list of releases in a dict representation.
        """
        releases = []

        # read releases from a set of files
        for release_yaml in glob.glob(self.config.openstack['releases']):
            with io.open(release_yaml, 'r', encoding='utf-8') as f:
                releases.extend(utils.load_fixture(f))

        return releases
示例#8
0
    def _read_releases(self):
        """Returns a list of releases in a dict representation.
        """
        releases = []

        # read releases from a set of files
        for release_yaml in glob.glob(self.config.openstack['releases']):
            with io.open(release_yaml, 'r', encoding='utf-8') as f:
                releases.extend(utils.load_fixture(f))

        # inject orchestrator_data into releases if empty
        #
        # NOTE(ikalnitsky): we can drop this block of code when
        #   we got two things done:
        #     * remove `fuelweb` word from default repos
        #     * add this template to `openstack.yaml`
        #     * fill orchestrator_data in nailgun during syncdb
        for release in releases:
            repo_path = \
                'http://{{MASTER_IP}}:8080/{{OPENSTACK_VERSION}}/{OS}/x86_64'\
                .format(OS=release['operating_system'].lower())

            if release['operating_system'].lower() == 'ubuntu':
                repo_path += ' precise main'

            release['orchestrator_data'] = {
                'puppet_manifests_source':
                'rsync://{MASTER_IP}:/puppet/{OPENSTACK_VERSION}/manifests/',

                'puppet_modules_source':
                'rsync://{MASTER_IP}:/puppet/{OPENSTACK_VERSION}/modules/',

                'repo_metadata': {
                    release['version']: repo_path}}

        return releases
示例#9
0
    def _read_releases(self):
        """Returns a list of releases in a dict representation.
        """
        releases = []

        # read releases from a set of files
        for release_yaml in glob.glob(self.config.openstack['releases']):
            with io.open(release_yaml, 'r', encoding='utf-8') as f:
                releases.extend(utils.load_fixture(f))

        # inject orchestrator_data into releases if empty
        for release in releases:
            meta = {
                'version': release['version'],
                'master_ip': self.config.astute['ADMIN_NETWORK']['ipaddress']
            }

            if 'ubuntu' == release['operating_system'].lower():
                repo = 'http://{master_ip}:8080/{version}/ubuntu/x86_64 ' \
                       'precise main'
            else:
                repo = 'http://{master_ip}:8080/{version}/centos/x86_64'

            release['orchestrator_data'] = {
                'puppet_manifests_source':
                ('rsync://{master_ip}:/puppet/{version}/manifests/'.format(
                    **meta)),
                'puppet_modules_source':
                ('rsync://{master_ip}:/puppet/{version}/modules/'.format(
                    **meta)),
                'repo_metadata': {
                    'nailgun': repo.format(**meta)
                }
            }

        return releases
示例#10
0
    def _read_releases(self):
        """Returns a list of releases in a dict representation.
        """
        releases = []

        # read releases from a set of files
        for release_yaml in glob.glob(self.config.openstack['releases']):
            with io.open(release_yaml, 'r', encoding='utf-8') as f:
                releases.extend(utils.load_fixture(f))

        # inject orchestrator_data into releases if empty
        #
        # NOTE(ikalnitsky): we can drop this block of code when
        #   we got two things done:
        #     * remove `fuelweb` word from default repos
        #     * add this template to `openstack.yaml`
        #     * fill orchestrator_data in nailgun during syncdb
        for release in releases:
            repo_path = \
                'http://{{MASTER_IP}}:8080/{{OPENSTACK_VERSION}}/{OS}/x86_64'\
                .format(OS=release['operating_system'].lower())

            if release['operating_system'].lower() == 'ubuntu':
                repo_path += ' precise main'

            release['orchestrator_data'] = {
                'puppet_manifests_source':
                'rsync://{MASTER_IP}:/puppet/{OPENSTACK_VERSION}/manifests/',
                'puppet_modules_source':
                'rsync://{MASTER_IP}:/puppet/{OPENSTACK_VERSION}/modules/',
                'repo_metadata': {
                    release['version']: repo_path
                }
            }

        return releases