summaryrefslogtreecommitdiffstats
path: root/cobbler
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-05-14 15:52:03 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-05-14 15:52:03 -0400
commitda5afb37f3d5f8ce4e4ad0508206eb68c8db25c9 (patch)
tree24cfe223fa29e0dbadcf6a1efecc53f1c7273059 /cobbler
parentb7217f4730ed54abaec95855a682c5c9f3b73870 (diff)
downloadthird_party-cobbler-da5afb37f3d5f8ce4e4ad0508206eb68c8db25c9.tar.gz
third_party-cobbler-da5afb37f3d5f8ce4e4ad0508206eb68c8db25c9.tar.xz
third_party-cobbler-da5afb37f3d5f8ce4e4ad0508206eb68c8db25c9.zip
Since it's common to want to reference the name of the profile in a template, and
that changes whether the rendering is a per-profile or per-system kickstart, I've added three new variables to make things easier: "distro_name", "profile_name", and "system_name" which show up in the templates automatically in addition to the existing "distro", "profile", and "name" you get for a system, or "distro" and "name" for profile. This is more consistant and easier to use in the templating language.
Diffstat (limited to 'cobbler')
-rw-r--r--cobbler/pxegen.py1
-rw-r--r--cobbler/utils.py13
2 files changed, 13 insertions, 1 deletions
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py
index 639c30b..d847569 100644
--- a/cobbler/pxegen.py
+++ b/cobbler/pxegen.py
@@ -84,7 +84,6 @@ class PXEGen:
"""
# copy is a 4-letter word but tftpboot runs chroot, thus it's required.
for d in self.distros:
- print _("sync distro: %s") % d.name
self.copy_single_distro_files(d)
def copy_single_distro_files(self, d):
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 6e756c9..a63f7af 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -370,6 +370,19 @@ def blender(api_handle,remove_hashes, root_obj):
# sanitize output for koan and kernel option lines, etc
if remove_hashes:
results = flatten(results)
+
+ # add in some variables for easier templating
+ # as these variables change based on object type
+ if results.has_key("interfaces"):
+ results["system_name"] = results["name"]
+ results["profile_name"] = results["profile"]
+ results["distro_name"] = results["distro"]
+ elif results.has_key("distro"):
+ results["profile_name"] = results["name"]
+ results["distro_name"] = results["distro"]
+ elif results.has_key("kernel"):
+ results["distro_name"] = results["name"]
+
return results
def flatten(data):