summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-09-17 17:45:50 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-09-17 17:45:50 -0400
commitb875715604c9a309b7a23d4c96842d9481851166 (patch)
tree359c82474f2e2954e4a354c5a16f9e4c5684fe5f
parent48ff1a38347ad45d480b133b03df2f6a5a7a5657 (diff)
downloadcobbler-b875715604c9a309b7a23d4c96842d9481851166.tar.gz
cobbler-b875715604c9a309b7a23d4c96842d9481851166.tar.xz
cobbler-b875715604c9a309b7a23d4c96842d9481851166.zip
Apply Partha's patch to add /usr/bin/cobbler/setup which is a program to help create settings and modules.conf, there are a few small bugs in this but it's mostly done. I've reworked the code for style/output somewhat and also added RPM packaging.
-rw-r--r--AUTHORS1
-rw-r--r--MANIFEST.in1
-rw-r--r--cobbler.spec4
-rw-r--r--installer_templates/modules.conf.template26
-rw-r--r--installer_templates/settings.template209
-rwxr-xr-xscripts/cobbler-setup501
-rw-r--r--setup.py16
7 files changed, 754 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 935ae8f6..9f3743a7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -7,6 +7,7 @@ Cobbler is written & maintained by:
Patches and other contributions from:
+ Partha Aji <paji@redhat.com>
Joseph Boyer Jr. <jboyer@liquidnet.com>
Andrew Brown <ambrown@ncsu.edu>
David Brown <dmlb2000@gmail.com>
diff --git a/MANIFEST.in b/MANIFEST.in
index ee1db3c9..514775c2 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -17,6 +17,7 @@ include config/completions
include config/cobbler_bash
include config/cheetah_macros
recursive-include templates *.template
+recursive-include installer_templates *.template
recursive-include kickstarts *.ks
recursive-include kickstarts *.seed
include docs/cobbler.1.gz
diff --git a/cobbler.spec b/cobbler.spec
index e020ac47..e6750ffb 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -91,6 +91,10 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%dir /var/www/cobbler/svc/
/var/www/cobbler/svc/*.py*
+%defattr(755,root,root)
+%dir /usr/share/cobbler/installer_templates
+%defattr(744,root,root)
+/usr/share/cobbler/installer_templates/*.template
%defattr(755,apache,apache)
%dir /usr/share/cobbler/webui_templates
%defattr(444,apache,apache)
diff --git a/installer_templates/modules.conf.template b/installer_templates/modules.conf.template
new file mode 100644
index 00000000..6b66b07c
--- /dev/null
+++ b/installer_templates/modules.conf.template
@@ -0,0 +1,26 @@
+# this file was auto-generated by /usr/bin/cobbler-setup
+#import time
+$time.asctime()
+# the previous file is saved as /etc/cobbler/settings.backup
+
+# FIXME: this file is based on an older version of cobbler and needs to be updated to devel
+
+
+[serializers]
+settings = serializer_yaml
+distro = serializer_yaml
+profile = serializer_yaml
+system = serializer_yaml
+repo = serializer_yaml
+
+[authentication]
+module = $authn_module
+
+[authorization]
+module = $authz_module
+
+[dns]
+module = $dns_module
+
+[dhcp]
+module = $dhcp_module
diff --git a/installer_templates/settings.template b/installer_templates/settings.template
new file mode 100644
index 00000000..cbf6e58d
--- /dev/null
+++ b/installer_templates/settings.template
@@ -0,0 +1,209 @@
+---
+# this file was auto-generated by /usr/bin/cobbler-setup
+#import time
+$time.asctime()
+# the previous file is saved as /etc/cobbler/settings.backup
+
+# FIXME: this file is based on an older version of cobbler
+# and needs to be updated to devel/latest
+
+# cobbler settings file
+# run "cobbler sync" after making changes
+# (it's a good idea to make backups too)
+#
+# if 1, cobbler will allow insertions of system records that duplicate
+# the mac address information of other system records. In general,
+# this is undesirable.
+allow_duplicate_macs: 0
+
+# if 1, cobbler will allow insertions of system records that duplicate
+# the ip address information of other system records. In general,
+# this is undesirable.
+allow_duplicate_ips: 0
+
+# the path to BIND's executable for this distribution.
+bind_bin: /usr/sbin/named
+
+# if no kickstart is specified, use this template (FIXME)
+default_kickstart: /etc/cobbler/default.ks
+
+# for libvirt based installs in koan, if no virt bridge
+# is specified, which bridge do we try?
+default_virt_bridge: xenbr0
+
+# if koan is invoked without --virt-type and no virt-type
+# is set on the profile/system, what virtualization type
+# should be assumed? Values: xenpv, xenfv, qemu, vmware
+default_virt_type: xenpv
+
+# use this as the default disk size for virt guests (GB)
+default_virt_file_size: 5
+
+# use this as the default memory size for virt guests (MB)
+default_virt_ram: 512
+
+# if using the authz_ownership module (see the Wiki), objects
+# created without specifying an owner are assigned to this
+# owner and/or group. Can be a comma seperated list.
+default_ownership: "admin"
+
+# location for some important binaries and config files
+# that can vary based on the distribution.
+dhcpd_bin: /usr/sbin/dhcpd
+dhcpd_conf: /etc/dhcpd.conf
+dnsmasq_bin: /usr/sbin/dnsmasq
+dnsmasq_conf: /etc/dnsmasq.conf
+httpd_bin: /usr/sbin/httpd
+
+# change this port if Apache is not running plaintext on port
+# 80. Most people can leave this alone.
+http_port: 80
+
+# kernel options that should be present in every cobbler installation.
+# kernel options can also be applied at the distro/profile/system
+# level.
+kernel_options:
+ ksdevice: eth0
+ lang: ' '
+ text: ~
+
+# configuration options if using the authn_ldap module. See the
+# the Wiki for details. This can be ignored if you are not using
+# LDAP for WebUI/XMLRPC authentication.
+ldap_server: "ldap.example.com"
+ldap_base_dn: "DC=example,DC=com"
+ldap_port: 389
+ldap_tls: 1
+ldap_anonymous_bind: 1
+ldap_search_bind_dn: ''
+ldap_search_passwd: ''
+ldap_search_prefix: 'uid='
+
+# set to 1 to enable Cobbler's DHCP management features.
+# the choice of DHCP management engine is in /etc/cobbler/modules.conf
+manage_dhcp: $enable_dhcp
+
+# set to 1 to enable Cobbler's DNS management features.
+# the choice of DNS mangement engine is in /etc/cobbler/modules.conf
+manage_dns: $enable_dns
+
+# if using BIND (named) for DNS management in /etc/cobbler/modules.conf
+# and manage_dns is enabled (above), this lists which zones are managed
+# See the Wiki (https://fedorahosted.org/cobbler/wiki/ManageDns) for more info
+manage_forward_zones: []
+manage_reverse_zones: []
+
+# if using cobbler with manage_dhcp, put the IP address
+# of the cobbler server here so that PXE booting guests can find it
+# if you do not set this correctly, this will be manifested in TFTP open timeouts.
+next_server: $next_server
+
+# if using cobbler with manage_dhcp and ISC, omapi allows realtime DHCP
+# updates without restarting ISC dhcpd.
+omapi_enabled: 1
+omapi_port: 647
+omshell_bin: /usr/bin/omshell
+
+# if this setting is set to 1, cobbler systems that pxe boot
+# will request at the end of their installation to toggle the
+# --netboot-enabled record in the cobbler system record. This eliminates
+# the potential for a PXE boot loop if the system is set to PXE
+# first in it's BIOS order. Enable this if PXE is first in your BIOS
+# boot order, otherwise leave this disabled. See the manpage
+# for --netboot-enabled.
+pxe_just_once: $pxe_once
+
+# when DHCP and DNS management are enabled, cobbler sync can automatically
+# restart those services to apply changes. The exception for this is
+# if using ISC for DHCP, then omapi eliminates the need for a restart.
+# If DHCP and DNS are going to be managed, but hosted on a box that
+# is not on this server, disable restarts here and write some other
+# script to ensure that the config files get copied/rsynced to the destination
+# box. This can be done by modifying the restart services trigger.
+# Note that if manage_dhcp and manage_dns are disabled, the respective
+# parameter will have no effect. Most users should not need to change
+# this.
+restart_dns: 1
+restart_dhcp: 1
+
+# if set to 1, new systems doing profile based installations will
+# contact cobbler to have system records created for them containing
+# the mac address information that they have requested for install.
+# this effectively allows for registration of new hardware via PXE
+# without having to manually enter in all of the mac addresses for
+# every machine on your network
+register_new_installs: 0
+
+# install triggers are scripts in /var/lib/cobbler/triggers/install
+# that are triggered in kickstart pre and post sections. Any
+# executable script in those directories is run. They can be used
+# to send email or perform other actions. They are currently
+# run as root so if you do not need this functionality you can
+# disable it, though this will also disable "cobbler status" which
+# uses a logging trigger to audit install progress.
+run_install_triggers: 1
+
+# this is the address of the cobbler server -- as it is used
+# by systems during the install process, it must be the address
+# or hostname of the system as those systems can see the server.
+# if you have a server that appears differently to different subnets
+# (dual homed, etc), you need to read the --server-override section
+# of the manpage for how that works.
+server: $server
+
+# this is a directory of files that cobbler uses to make
+# templating easier. See the Wiki for more information. Changing
+# this directory should not be required.
+snippetsdir: /var/lib/cobbler/snippets
+
+# by default, installs are set to send syslog traffic on this port
+# and cobblerd will listen on this port. syslog data (for installs
+# that support it... RHEL 5 and later, etc) is logged in /var/log/cobbler
+# and can be used to help debug problematic installations. Syslog
+# is UDP and may not be available depending on network/firewall configuration.
+syslog_port: 25150
+
+# locations of the TFTP binary and config file
+tftpd_bin: /usr/sbin/in.tftpd
+tftpd_conf: /etc/xinetd.d/tftp
+
+# cobbler's web directory. Don't change this setting -- see the
+# Wiki on "relocating your cobbler install" if your /var partition
+# is not large enough.
+webdir: /var/www/cobbler
+
+# cobbler's public XMLRPC listens on this port. Change this only
+# if absolutely needed, as you'll have to start supplying a new
+# port option to koan if it is not the default.
+xmlrpc_port: 25151
+
+# cobbler's read write XMLRPC is the version of XMLRPC
+# used by the WebUI and some features like system registration.
+# XMLRPC connections here require login information to access.
+# this feature can be disabled to gain increased security but
+# will disable the WebUI, registration, and potentially other
+# cobbler features. Most users should leave XMLRPC RW
+# enabled. The port can be relocated if needed.
+xmlrpc_rw_enabled: 1
+xmlrpc_rw_port: 25152
+
+# "cobbler repo add" commands set cobbler up with repository
+# information that can be used during kickstart and is automatically
+# set up in the cobbler kickstart templates. By default, these
+# are only available at install time. To make these repositories
+# usable on installed systems (since cobbler makes a very convient)
+# mirror, set this to 1. Most users can safely set this to 1. Users
+# who have a dual homed cobbler server, or are installing laptops that
+# will not always have access to the cobbler server may wish to leave
+# this as 0. In that case, the cobbler mirrored yum repos are still
+# accessable at http://cobbler.example.org/cblr/repo_mirror and yum
+# configuration can still be done manually. This is just a shortcut.
+yum_post_install_mirror: $yum_post_install_mirror
+
+# "cobbler repo" support normally uses rsync or reposync. If --rpm-list
+# is used, it's possible to download only a certain package list, plus
+# dependencies, but --resolve and other flags are not supported in
+# all versions of yumdownloader. This is a list of what flags
+# to pass to it. Only change this if you are experiencing problems
+# with "cobbler reposync" and are using --rpm-list.
+yumdownloader_flags: "--resolve"
diff --git a/scripts/cobbler-setup b/scripts/cobbler-setup
new file mode 100755
index 00000000..f835f773
--- /dev/null
+++ b/scripts/cobbler-setup
@@ -0,0 +1,501 @@
+#!/usr/bin/env python
+
+"""
+Q&A based tool for setting up cobbler.conf and modules.conf
+
+Copyright 2008, Red Hat, Inc
+Partha Aji <paji@redhat.com>
+Michael DeHaan <mdehaan@redhat.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+"""
+
+import cobbler.yaml as yaml
+import optparse
+import Cheetah.Template as Template
+import socket
+import shutil
+import os.path
+import exceptions
+
+# FIXME: use subprocess.call() with shell=False instead
+# FIXME: check all return codes
+from os import system
+
+import sys
+import os
+from decimal import Decimal
+
+try:
+ import readline
+ readline.parse_and_bind("tab: complete")
+except:
+ pass
+
+class AnswerException(exceptions.Exception):
+ """
+ Custom exceptions class so we only catch exceptions that we know are input related.
+ """
+ pass
+
+def help_ask(caption, validators=[], transformers =[], default = None, required=True, max_len = None):
+ """
+ Helper method to gather input from the console. This method has a bunch of useful addons
+ like validators and transformers. Validators are a chain of objects that validate the input
+ and raise an exception in the case of bad data, while transformers are methods that
+ transform the input to int or decimals..
+ """
+
+ default_label = default and (" (default=%s)" % default) or ""
+ label = caption + default_label +": "
+
+ input = raw_input(label).strip()
+
+ try:
+
+ if input or not default:
+ if required:
+ len_check(min_len = 1)(input)
+ if max_len:
+ len_check(max_len = max_len)(input)
+ for validate in validators:
+ validate(input)
+ else:
+ input = default
+ for transform in transformers:
+ input = transform(input)
+
+ except AnswerException, e:
+
+ if hasattr(e, "message"):
+ print "Invalid value: %s " % (e.message)
+ elif len(e.args) == 1:
+ print "Invalid value: %s " % e.args[0]
+ else:
+ print e
+
+ return help_ask(caption, validators = validators,
+ transformers = transformers, default = default,
+ required = required, max_len = max_len)
+ return input
+
+# =========================================================
+
+def to_int(input):
+ """
+ A transformer emthod to convert a string input to an integer
+ """
+
+ try:
+ return int(input)
+ except ValueError:
+ raise AnswerException ('Input is not an integer')
+
+# =========================================================
+
+def to_float(input):
+ """
+ A transformer emthod to convert a string input to a float.
+ """
+ try:
+ return float(input)
+ except ValueError, e:
+ raise AnswerException ('Input needs to be a number')
+
+# =========================================================
+
+def to_decimal(input):
+ """
+ A transformer emthod to convert a string input to an decimal
+ """
+ try:
+ return Decimal(input)
+ except:
+ raise AnswerException ('Input needs to be a number (can be a decimal)')
+
+# =========================================================
+
+def translator(transdict = {}):
+ def translate (input,transdict = transdict):
+ return transdict[input]
+ return translate
+
+# =========================================================
+
+def yes_no_translator():
+ return translator({ "y": 1, "Y" : 1, "n" : 0, "N" : 0})
+
+# =========================================================
+
+def len_check(min_len = None, max_len = None, exact_len = None):
+ """
+ Validator method to ensure the input has a max_len, a min_len o an exact len
+ each of these options are used in different instances, for example if we
+ want the state name = 2 characters we would have exact_len = 2...
+ """
+
+ def exact(input, length = exact_len):
+ if len(input) != length:
+ raise AnswerException ('Input needs to be exactly %d characters' % length)
+
+ def min_check(input, length = min_len):
+ if len(input) < length:
+ raise AnswerException('Input needs to be atleast %d characters' % length)
+
+ def max_check(input, length = max_len):
+ if len(input) > length:
+ raise AnswerException('Input needs to be atmost %d characters' % length)
+
+ def check_both(input, min_len = min_len, max_len = max_len):
+ if not min_len <= len(input) <= max_len:
+ raise AnswerException('Input needs to be atleast %d and atmost %d characters' % (min_len, max_len))
+
+ if exact_len:
+ return exact
+ if min_len and max_len:
+ return check_both
+ if min_len:
+ return min_check
+ if max_len:
+ return max_check
+
+# =========================================================
+
+def enum_check(enums):
+ """
+ Userful validator to ensure that the user's input conforms to a list of enum values. This is particularly
+ useful for Y/N inputs..
+ """
+ def check(input, enums = enums):
+ if input not in enums:
+ raise AnswerException('Input needs to be one of (%s)' % '/'.join(enums))
+ return check
+
+# =========================================================
+
+def yes_no_check():
+ return enum_check(["y","n"])
+
+# =========================================================
+
+def range_check(min_val = None, max_val = None):
+ """
+ Ensures that the numeric value o an input falls between a given range.
+ """
+ def check(input, min_val = min_val, max_val = max_val):
+ input = to_decimal(input)
+ if min_val and max_val and not (min_val <= input <= max_val):
+ raise AnswerException('Input needs to be between %d and %d ' % (min_val, max_val))
+ elif min_val and input < min_val:
+ raise AnswerException('Input needs to be >= %d' % min_val)
+ elif max_val and input > max_val:
+ raise AnswerException('Input needs to be <= %d' % max_val)
+
+ return check
+
+# =========================================================
+
+def setup_server(answers):
+ hostname = socket.gethostbyname(socket.gethostname())
+ parameters = { "default" : hostname }
+ ask(answers,
+ 'server', 'What is the resolvable address/ip of this server [leave blank for autodiscover] ?',
+ parameters
+ )
+
+# =========================================================
+
+def setup_dhcp(answers):
+ parameters = {
+ "default" : "y",
+ "validators" : [yes_no_check()],
+ "transformers" : [yes_no_translator()]
+ }
+ ask(answers,'enable_dhcp',"Do you want to enable DHCP management [y/n] ?",parameters)
+
+ if answers['enable_dhcp']:
+ answers['next_server'] = answers['server']
+ else:
+ answers['next_server'] = '127.0.0.1'
+
+
+ if answers['enable_dhcp']:
+
+ # DHCP management is either ISC or dnsmasq
+ translators = {
+ "isc" : "manage_isc",
+ "dnsmasq" : "manage_dnsmasq"
+ }
+ parameters = {
+ "default" : "isc",
+ "validators" : [enum_check(translators.keys())],
+ "transformers" : [translator(translators)]
+ }
+ ask(
+ answers,
+ 'dhcp_module',
+ "Which DNS module do you want to use [isc/dnsmasq] ?",
+ parameters
+ )
+
+ else:
+
+ answers['dhcp_module'] = "manage_isc"
+
+# =========================================================
+
+def setup_dns(answers):
+
+ parameters = {
+ "default" : "y",
+ "validators" : [yes_no_check()],
+ "transformers" : [yes_no_translator()]
+ }
+
+ # if the user already is using dnsmasq for DHCP, they must use dnsmasq for DNS
+ # if they are not, they get the choice of BIND or no module
+
+ if answers["enable_dhcp"] and answers["dhcp_module"] == "dnsmasq":
+
+ answers["enable_dns"] = True
+ answers["dns_module"] = "manage_dnsmasq"
+
+ else:
+
+ ask(answers,
+ 'enable_dns',
+ "Do you want to enable DNS management with BIND [y/n] ?",
+ parameters
+ )
+
+ if answers["enable_dns"]:
+ answers["dns_module"] = "manage_bind"
+
+# =========================================================
+
+def setup_pxe(answers):
+ parameters = {
+ "default" : "y",
+ "validators" : [yes_no_check()],
+ "transformers" : [yes_no_translator()]
+ }
+
+ ask(
+ answers,
+ 'pxe_once',
+ "Enable PXE boot loop prevention feature [y/n] ?",
+ parameters
+ )
+
+# =========================================================
+
+def setup_mirrors(answers):
+ parameters = {
+ "default" : "n",
+ "validators" : [yes_no_check()],
+ "transformers" : [yes_no_translator()]
+ }
+ ask(
+ answers,
+ 'yum_post_install_mirror',
+ "Make cobbler managed yum repos available to installed systems via yum.repos.d [y/n] ?",
+ parameters
+ )
+
+# =========================================================
+
+
+def setup_remote_config(answers):
+
+ ask (answers, "enable_remote_access",
+ "Allow cobbler to be managed by the web and other applications [y/n] ?",
+ dict(default="y", validators=[yes_no_check()],
+ transformers=[yes_no_translator()]))
+
+ if answers['enable_remote_access']:
+ translation = dict (testing = "authn_testing",
+ passthru = "authn_passthru",
+ denyall = "authn_denyall",
+ ldap = "authn_ldap",
+ configfile = "authn_configfile",
+ spacewalk = "authn_spacewalk"
+ )
+
+ ask (answers, "authn_module",
+ "Which authentication module do you want to use [%s] ?" % "/".join(translation.keys()),
+ dict(default="denyall",
+ validators=[enum_check(translation.keys())],
+ transformers= [translator(translation)]))
+
+ if answers['authn_module'] == 'authn_configfile':
+
+ print "* Updating cobbler user's password in user.digest file"
+ os.system('htdigest -c users.digest Cobbler cobbler')
+ print "* users can run 'htdigest /etc/users.digest Cobbler $username' later to add more users & change cobbler password"
+
+ translation = dict (allowall = "authz_allowall",
+ ownership = "authz_ownership",
+ configfile = "authz_configfile")
+
+ ask (answers, "authz_module",
+ "Which authorization module do you want to use [%s] ?" % "/".join(translation.keys()),
+ dict(default="allowall",
+ validators=[enum_check(translation.keys())],
+ transformers= [translator(translation)]))
+
+ else:
+
+ answers['authn_module'] = "authn_denyall"
+ answers['authz_module'] = "authz_allowall"
+
+# =========================================================
+
+def setup(parser):
+
+ parser.add_option("-a", "--answers-file", dest="file",
+ help="pass in a answers file in yaml format")
+
+# =========================================================
+
+def ask(answers, key, question, params=None):
+
+ # code to prevent re-asking the question?
+ #if key in answers:
+ # return answers[key]
+
+ if params is None:
+ params = {}
+
+ caption = question
+
+ answer = help_ask(
+ question,
+ validators = params.get("validators",[]),
+ transformers = params.get("transformers",[]),
+ default = params.get("default",None),
+ required = params.get("required",True),
+ max_len = params.get("max_len",True)
+ )
+
+ answers[key] = answer
+ print "\n" # leave some nice whitespace for the humans
+
+ return answer
+
+# =========================================================
+
+def templatify(template, answers, output):
+
+ t = Template.Template(file=template, searchList=answers)
+ open(output,"w").write(t.respond())
+
+# =========================================================
+
+def copy_settings():
+
+ if os.path.exists("users.digest"):
+ shutil.copy("/etc/cobbler/users.digest", "/etc/cobbler/users.digest.old")
+
+ shutil.copy("/etc/cobbler/settings", "/etc/cobbler/settings.old")
+ shutil.copy("/etc/cobbler/modules.conf", "/etc/cobbler/modules.conf.old")
+
+
+
+# =========================================================
+
+def main():
+
+ print ""
+ print "**********************************************"
+ print "Setting up the Cobbler provisioning server."
+ print "http://fedorahosted.org/cobbler"
+
+ os.system("rpm -q cobbler")
+
+ print ""
+ print "if you have already configured cobbler, Ctrl+C now."
+ print "This script will modify /etc/cobbler/settings"
+ print "and /etc/cobbler/modules.conf."
+ print "Backups are saved as /etc/cobbler/*.backup"
+ print "**********************************************"
+ print ""
+
+ parser = optparse.OptionParser()
+ setup(parser)
+ (options, args) = parser.parse_args()
+
+ answers = {}
+ # FIXME: add --file with help to option parser
+ #if options.file:
+ # data = yaml.loadFile(parser.file).next()
+ # answers.update(data)
+
+ setup_server(answers)
+ setup_dhcp(answers)
+ setup_dns(answers)
+ setup_remote_config(answers)
+ setup_pxe(answers)
+ setup_mirrors(answers)
+
+ copy_settings()
+
+ # copy settings /before/ overwriting them
+ templatify("/usr/share/cobbler/installer_templates/settings.template",answers,"/etc/cobbler/settings")
+ templatify("/usr/share/cobbler/installer_templates/modules.conf.template",answers,"/etc/cobbler/modules.conf")
+
+ # FIXME: missing code to ensure TFTP is enabled
+ # FIXME: missing code to configure firewall (???)
+ # FIXME: missing code to ensure cobblerd, httpd, xinetd is chkconfig on
+
+ print ""
+ print "***********************************************"
+ print "Restarting install services prior to running"
+ print "diagnostics on install server configuration"
+ print "***********************************************"
+ print ""
+
+ os.system("/sbin/service cobblerd restart")
+ os.system("/sbin/service httpd restart")
+
+ print ""
+ print "***********************************************"
+ print "The following information may represent"
+ print "outstanding problems with your install server"
+ print "configuration that probably should be addressed."
+ print "These may be reviewed at any time by running"
+ print "'cobbler check'. Any other runtime problems"
+ print "may be logged to the Apache error log or"
+ print "/var/log/cobbler.log."
+ print "***********************************************"
+ print ""
+
+ #print "Running cobbler check ..."
+ os.system("cobbler check")
+
+ print ""
+ print "***********************************************"
+ print "Install server installation complete. Review"
+ print "messages above and correct any problems that are"
+ print "listed."
+ print "***********************************************"
+ print ""
+
+# =========================================================
+
+if __name__=="__main__":
+ if not os.getuid() == 0:
+ sys.stderr.write(" -- WARNING: don't you want to run this as root?\n")
+ main()
diff --git a/setup.py b/setup.py
index 7588b9d9..26d7368b 100644
--- a/setup.py
+++ b/setup.py
@@ -41,6 +41,7 @@ if __name__ == "__main__":
vw_profiles = "/var/www/cobbler/profiles"
vw_links = "/var/www/cobbler/links"
zone_templates = "/etc/cobbler/zone_templates"
+ itemplates = "/usr/share/cobbler/installer_templates"
tftp_cfg = "/tftpboot/pxelinux.cfg"
tftp_images = "/tftpboot/images"
rotpath = "/etc/logrotate.d"
@@ -61,13 +62,16 @@ if __name__ == "__main__":
"cobbler/server",
"cobbler/webui",
],
- scripts = ["scripts/cobbler", "scripts/cobblerd", "scripts/cobbler-ext-nodes", "scripts/cobbler-completion"],
+ scripts = [
+ "scripts/cobbler",
+ "scripts/cobblerd",
+ "scripts/cobbler-ext-nodes",
+ "scripts/cobbler-completion",
+ "scripts/cobbler-setup",
+ ],
data_files = [
(modpython, ['scripts/index.py']),
(modpythonsvc, ['scripts/services.py']),
- # cgi files
- # (cgipath, ['scripts/nopxe.cgi']),
- # (cgipath, ['scripts/install_trigger.cgi']),
# miscellaneous config files
(rotpath, ['config/cobblerd_rotate']),
@@ -119,6 +123,10 @@ if __name__ == "__main__":
(etcpath, ['templates/pxelocal.template']),
(etcpath, ['templates/zone.template']),
+ # templates for /usr/bin/cobbler-setup
+ (itemplates, ['installer_templates/modules.conf.template']),
+ (itemplates, ['installer_templates/settings.template']),
+
# kickstart dir
(vl_kick, []),