summaryrefslogtreecommitdiffstats
path: root/cobbler/item.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-07-12 17:00:49 -0400
committerJim Meyering <jim@meyering.net>2006-07-12 17:00:49 -0400
commitbea30de4beb585b5c79d10c6164e65713f1611bc (patch)
tree435799b37baa464c21e42e622914cbdd8b33276f /cobbler/item.py
parentf061199e4f8a3ea0e769325e72029ca7d791b206 (diff)
downloadcobbler-bea30de4beb585b5c79d10c6164e65713f1611bc.tar.gz
cobbler-bea30de4beb585b5c79d10c6164e65713f1611bc.tar.xz
cobbler-bea30de4beb585b5c79d10c6164e65713f1611bc.zip
Added templating support through new --ks_meta option which works like --kopts. The parameter is a space delimited list of key=value pairs, which allows the variables entered to be evaluated through Cheetah. Thus kickstarts are now Cheetah templates. All templating errors are ignored so usage of a $ in a template is still legal where it doesn't reference a variable. Error ignoring should be finer grained and this does need some tests. Currently this only works for kickstarts on filesystems, and I'm not sure what the behavior for http and nfs should be. Anyhow, fairly useful stuff.
Diffstat (limited to 'cobbler/item.py')
-rw-r--r--cobbler/item.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/cobbler/item.py b/cobbler/item.py
index 9e8a5ba2..6c55225c 100644
--- a/cobbler/item.py
+++ b/cobbler/item.py
@@ -34,6 +34,20 @@ class Item(serializable.Serializable):
self.kernel_options = options_string
return True
+ 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
+ to preprocess kickstart files
+ """
+ self.ks_meta = options_string
+ tokens = self.ks_meta.split(",")
+ for t in tokens:
+ tokens2 = t.split("=")
+ if len(tokens2) != 2:
+ return False
+ return True
+
def to_datastruct(self):
"""
Returns an easily-marshalable representation of the collection.