diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-10-02 17:21:21 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-10-02 17:21:21 -0400 |
commit | 07073d4af69a09c33c64d31c4668ac2489d88ffb (patch) | |
tree | 25779838097c28d0a9e37fdf726587402eafed98 /setup.py | |
parent | 96ffcc2c6a80cf1a8bbabe5995ab2d90f959fcb6 (diff) | |
download | cobbler-07073d4af69a09c33c64d31c4668ac2489d88ffb.tar.gz cobbler-07073d4af69a09c33c64d31c4668ac2489d88ffb.tar.xz cobbler-07073d4af69a09c33c64d31c4668ac2489d88ffb.zip |
Apply Partha's patch to generate the settings file and modules.conf file from the cobbler-setup
templates so we don't have to maintain all three of the defaults, templates, and the versions of the config files the rpm lays down
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -4,14 +4,34 @@ import sys import os.path from distutils.core import setup, Extension import string +import cobbler.yaml as yaml +import Cheetah.Template as Template VERSION = "1.3.0" SHORT_DESC = "Network Boot and Update Server" LONG_DESC = """ Cobbler is a network boot and update server. Cobbler supports PXE, provisioning virtualized images, and reinstalling existing Linux machines. The last two modes require a helper tool called 'koan' that integrates with cobbler. Cobbler's advanced features include importing distributions from DVDs and rsync mirrors, kickstart templating, integrated yum mirroring, and built-in DHCP/DNS Management. Cobbler also has a Python and XMLRPC API for integration with other applications. """ +TEMPLATES_DIR = "installer_templates" +DEFAULTS = os.path.join(TEMPLATES_DIR, "defaults") +MODULES_TEMPLATE = os.path.join(TEMPLATES_DIR, "modules.conf.template") +SETTINGS_TEMPLATE = os.path.join(TEMPLATES_DIR, "settings.template") +OUTPUT_DIR = "config" + +# ========================================================= +def templatify(template, answers, output): + t = Template.Template(file=template, searchList=answers) + open(output,"w").write(t.respond()) + +def gen_config(): + defaults = {} + data = yaml.loadFile(DEFAULTS).next() + defaults.update(data) + templatify(MODULES_TEMPLATE, defaults, os.path.join(OUTPUT_DIR, "modules.conf")) + templatify(SETTINGS_TEMPLATE, defaults, os.path.join(OUTPUT_DIR, "settings")) if __name__ == "__main__": + gen_config() # docspath="share/doc/koan-%s/" % VERSION bashpath = "/etc/bash_completion.d/" manpath = "share/man/man1/" |