'Generate rsync modules of all repositories and distributions'

def rsync_gen(self):

    template_file = '/etc/cobbler/rsync.template'
    try:
        template = open(template_file, 'r')
    except:
        raise CX((_('error    reading    template    %s') % template_file))
    template_data = ''
    template_data = template.read()
    template.close()
    distros = []
    for link in glob.glob(os.path.join(self.settings.webdir, 'links', '*')):
        distro = {}
        distro['path'] = os.path.realpath(link)
        distro['name'] = os.path.basename(link)
        distros.append(distro)
    repos = [repo.name for repo in self.api.repos() if os.path.isdir(os.path.join(self.settings.webdir, 'repo_mirror', repo.name))]
    metadata = {'date': time.asctime(time.gmtime()), 'cobbler_server': self.settings.server, 'distros': distros, 'repos': repos, 'webdir': self.settings.webdir}
    self.templar.render(template_data, metadata, '/etc/rsyncd.conf', None)
