def test_read_from_yaml(self, yaml_mock):
        path = '/tmp/path'
        data = yaml.dump({'a': 'b'})
        mock_open = self.mock_open(data)
        with mock.patch('fuel_upgrade.utils.io.open', mock_open):
            utils.read_from_yaml(path)

        yaml_mock.load.assert_called_once_with(data)
Example #2
0
    def test_read_from_yaml(self, yaml_mock):
        path = '/tmp/path'
        data = yaml.dump({'a': 'b'})
        mock_open = self.mock_open(data)
        with mock.patch('fuel_upgrade.utils.io.open', mock_open):
            utils.read_from_yaml(path)

        yaml_mock.load.assert_called_once_with(data)
    def upload_release_deployment_tasks(self, release):
        """Performs os.walk by puppet src, matches all files with tasks
        of given pattern and uploads this for release.

        :param release: dict representation of release
        """
        tasks = []
        release_puppet_path = os.path.join(
            self.config.openstack['puppets']['dst'], release['version'])

        for file_path in utils.iterfiles_filter(
                release_puppet_path,
                self.config.deployment_tasks_file_pattern):

            tasks.extend(utils.read_from_yaml(file_path))

        self.nailgun.put_deployment_tasks(release, tasks)
Example #4
0
    def upload_release_deployment_tasks(self, release):
        """Performs os.walk by puppet src, matches all files with tasks
        of given pattern and uploads this for release.

        :param release: dict representation of release
        """
        tasks = []
        release_puppet_path = os.path.join(
            self.config.openstack['puppets']['dst'], release['version'])

        for file_path in utils.iterfiles_filter(
                release_puppet_path,
                self.config.deployment_tasks_file_pattern):

            tasks.extend(utils.read_from_yaml(file_path))

        self.nailgun.put_deployment_tasks(release, tasks)