diff options
-rw-r--r-- | cobbler/action_sync.py | 11 | ||||
-rw-r--r-- | dhcp.template | 20 |
2 files changed, 12 insertions, 19 deletions
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 7b40f2e..a4699ee 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -15,6 +15,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import os import shutil +import time import yaml from Cheetah.Template import Template @@ -79,22 +80,24 @@ class BootSync: self.copyfile(path, destpath) def write_dhcp_file(self): - f1 = self.open_file("/etc/dhcpd.conf") - template_data = "" try: - f2 = open("/etc/cobbler/dhcp.template") + f2 = open("/etc/cobbler/dhcp.template","r") except: raise cexceptions.CobblerException("exc_no_template") + template_data = "" + f1 = self.open_file("/etc/dhcpd.conf","w+") template_data = f2.read() f2.close() system_definitions = "<INSERT COBBLER LIST HERE>" metadata = { - "insert_cobbler_system_definitions" : system_definitions + "insert_cobbler_system_definitions" : system_definitions, + "date" : time.asctime(time.gmtime()) } t = Template( "#errorCatcher Echo\n%s" % template_data, searchList=[metadata] ) + self.tee(f1,str(t)) self.close_file(f1) def configure_httpd(self): diff --git a/dhcp.template b/dhcp.template index 700de4c..bc95bfc 100644 --- a/dhcp.template +++ b/dhcp.template @@ -5,30 +5,24 @@ # # Note to Admins: # -# cobbler will only manage dhcpd.conf if manage_dhcp is set in +# cobbler will only manage dhcpd.conf if "manage_dhcp: 1" is set in # /var/lib/cobbler/settings and will only be updated -# when cobbler sync is run. For configuring systems, see -# "man cobbler" +# when "cobbler sync" is run. Also see "man cobbler" # # ****************************************************************** # ** these values are probably sane for most environments ddns-update-style ad-hoc; set vendorclass = option vendor-class-identifier; - -# ** DO *NOT* change anything in this section or PXE will stop working -# cobbler will magically deal with PXE architecture changes allow booting; allow bootp; -filename "/pxelinux.i386"; +filename "/pxelinux.0"; +default-lease-time 7200; +max-lease-time 86400; # ** this value must point to your cobbler server next-server 10.10.76.51; -# ** it's ok to change this values if needed -default-lease-time 7200; -max-lease-time 86400; - # ** these values must be changed for your network option domain-name "foo.example_corp.com bar.example_corp.com" option domain-name-servers 172.16.52.28, 172.16.52.27; @@ -42,10 +36,6 @@ shared-network rhndev { } } - # ** leave this line intact $insert_cobbler_system_definitions -# ** optional footer data here -# ... - |