'Generate configuration data for repos, files and packages.
Returns a dict.'

def gen_config_data(self):

    config_data = {'repo_data': self.handle.get_repo_config_for_system(self.system), 'repos_enabled': self.get_cobbler_resource('repos_enabled')}
    package_set = set()
    file_set = set()
    for mgmtclass in self.mgmtclasses:
        _mgmtclass = self.handle.find_mgmtclass(name=mgmtclass)
        for package in _mgmtclass.packages:
            package_set.add(package)
        for file in _mgmtclass.files:
            file_set.add(file)
    pkg_data = {}
    for package in package_set:
        _package = self.handle.find_package(name=package)
        if (_package is None):
            raise CX(('%s    package    resource    is    not    defined' % package))
        else:
            pkg_data[package] = {}
            pkg_data[package]['action'] = self.resolve_resource_var(_package.action)
            pkg_data[package]['installer'] = _package.installer
            pkg_data[package]['version'] = self.resolve_resource_var(_package.version)
            if (pkg_data[package]['version'] != ''):
                pkg_data[package]['install_name'] = ('%s-%s' % (package, pkg_data[package]['version']))
            else:
                pkg_data[package]['install_name'] = package
    config_data['packages'] = pkg_data
    file_data = {}
    for file in file_set:
        _file = self.handle.find_file(name=file)
        if (_file is None):
            raise CX(('%s    file    resource    is    not    defined' % file))
        file_data[file] = {}
        file_data[file]['is_dir'] = _file.is_dir
        file_data[file]['action'] = self.resolve_resource_var(_file.action)
        file_data[file]['group'] = self.resolve_resource_var(_file.group)
        file_data[file]['mode'] = self.resolve_resource_var(_file.mode)
        file_data[file]['owner'] = self.resolve_resource_var(_file.owner)
        file_data[file]['path'] = self.resolve_resource_var(_file.path)
        if (not _file.is_dir):
            file_data[file]['template'] = self.resolve_resource_var(_file.template)
            try:
                t = Template(file=file_data[file]['template'], searchList=[self.host_vars])
                file_data[file]['content'] = t.respond()
            except:
                utils.die(self.logger, ('Missing    template    for    this    file    resource    %s' % file_data[file]))
    config_data['files'] = file_data
    return config_data
