diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-10-09 16:54:40 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-10-09 16:54:40 -0400 |
commit | 0b956ed3e7395139b30d65d37a88ceb1c8f692b9 (patch) | |
tree | 4498497ac030bfe080bba12605fc419345f98f83 /cobbler/utils.py | |
parent | cfbd8af8d57f9974ca267845f05d2c3a9d7ff94f (diff) | |
download | third_party-cobbler-0b956ed3e7395139b30d65d37a88ceb1c8f692b9.tar.gz third_party-cobbler-0b956ed3e7395139b30d65d37a88ceb1c8f692b9.tar.xz third_party-cobbler-0b956ed3e7395139b30d65d37a88ceb1c8f692b9.zip |
A few bugfixes. Still working on multiple NICs.
Diffstat (limited to 'cobbler/utils.py')
-rw-r--r-- | cobbler/utils.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/cobbler/utils.py b/cobbler/utils.py index c7dbd20..6613e42 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -295,6 +295,19 @@ def blender(remove_hashes, root_obj): if len(kernel_txt) < 244: results["kernel_options"]["kssendmac"] = None + # make interfaces accessible without Cheetah-voodoo in the templates + # EXAMPLE: $ip == $ip0, $ip1, $ip2 and so on. + + if root_obj.COLLECTION_TYPE == "system": + counter = 0 + for (name,interface) in root_obj.interfaces.iteritems(): + for key in interface.keys(): + results["%s%d" % (key,counter)] = interface[key] + # just to keep templates backwards compatibile + if counter == 0: + results[key] = interface[key] + counter = counter + 1 + # sanitize output for koan and kernel option lines, etc if remove_hashes: results = flatten(results) @@ -312,17 +325,9 @@ def flatten(data): data["repos"] = " ".join(data["repos"]) if data.has_key("rpm_list") and type(data["rpm_list"]) == list: data["rpm_list"] = " ".join(data["rpm_list"]) - if data.has_key("interfaces"): - # make interfaces accessible without Cheetah-voodoo in the templates - # EXAMPLE: $ip == $ip0, $ip1, $ip2 and so on. - counter = 0 - for (name,interface) in data["interfaces"].iteritems(): - for key in interface.keys(): - data["%s%d" % (key,counter)] = interface[key] - # just to keep templates backwards compatibile - if counter == 0: - data[key] = interface[key] - counter = counter + 1 + + # note -- we do not need to flatten "interfaces" as koan does not expect + # it to be a string, nor do we use it on a kernel options line, etc... return data |