From 6e4c8456fe7e11595593a2568c10653dedc287f4 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Tue, 17 Oct 2006 16:26:12 -0400 Subject: Removing Cheetah to simplify deps, also don't delete the localmirror on sync (that's bad!). --- TODO | 2 ++ cobbler/action_sync.py | 22 +++++++--------------- cobbler/item.py | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/TODO b/TODO index dc552ba..a28eb11 100644 --- a/TODO +++ b/TODO @@ -10,6 +10,8 @@ core: - import over http://, ftp:// in addition to existing file and rsync:// - imports should save distros as they find them (api.serialize) - imports over NFS should be a lot faster... speedup improvements? + - remove Cheetah and pexpect dependencies to make things work nicer + with RHEL4. user interface: - "cobbler add" should be distinguished from "edit" so as to not overwrite diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 43f6f15..e1c7de2 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -20,7 +20,6 @@ import time import yaml # Howell-Clark version import sub_process import sys -from Cheetah.Template import Template import utils import cobbler_msg @@ -143,10 +142,8 @@ class BootSync: "date" : time.asctime(time.gmtime()), "next_server" : self.settings.next_server } - t = Template( - "#errorCatcher Echo\n%s" % template_data, - searchList=[metadata] - ) + for x in metadata.keys(): + template_data = template_data.replace("$%s" % x, metadata[x]) self.tee(f1,str(t)) self.close_file(f1) @@ -194,7 +191,8 @@ class BootSync: if os.path.isfile(path): self.rmfile(path) if os.path.isdir(path): - self.rmtree(path) + if not x == "localmirror": + self.rmtree(path) # make some directories in /tftpboot for x in ["pxelinux.cfg","images"]: @@ -324,16 +322,10 @@ class BootSync: fd = open(kickstart_input) data = fd.read() fd.close() - data = data.replace("$","@@DOLLAR_SIGN@@") - data = data.replace("TEMPLATE::","$") - t = Template( - "#errorCatcher Echo\n%s" % data, - searchList=[metadata], - ) - computed = str(t) - computed = computed.replace("@@DOLLAR_SIGN@@","$") + for x in metadata.keys(): + data = data.replace("TEMPLATE::%s" % x, metadata[x]) fd = open(out_path, "w+") - fd.write(computed) + fd.write(data) fd.close() def build_trees(self): diff --git a/cobbler/item.py b/cobbler/item.py index 6dad205..7f7335e 100644 --- a/cobbler/item.py +++ b/cobbler/item.py @@ -37,7 +37,7 @@ class Item(serializable.Serializable): def set_ksmeta(self,options_string): """ A comma delimited list of key value pairs, like 'a=b,c=d,e=f'. - The meta tags are used as input to the Cheetah templating system + The meta tags are used as input to the templating system to preprocess kickstart files """ self.ks_meta = options_string -- cgit