With thanks going to Jasper Capel - here is a better patch to fix
buildiso networking when using bonding.
Also included is a patch to sort the menu items for systems and profiles
in to order.
Thanks
Dave Hatton
From 9e817d336a75e57eab0a0462a174ac40424f37e1 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Fri, 23 Jan 2009 10:59:48 +0000
Subject: [PATCH] Sort profiles and systems into order on menu
---
cobbler/action_buildiso.py | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index 7fa2c5a..14c51fc 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -164,7 +164,14 @@ class BuildIso:
cfg.write(HEADER) # fixme, use template
print _("- generating profile list...")
- for profile in self.api.profiles():
+
+ #sort the profiles
+ profile_list = [profile for profile in self.profiles]
+ def sort_name(a,b):
+ return cmp(a.name,b.name)
+ profile_list.sort(sort_name)
+
+ for profile in profile_list:
use_this = True
if profiles is not None:
which_profiles = profiles.split(",")
@@ -204,7 +211,13 @@ class BuildIso:
cfg.write("\nMENU SEPARATOR\n")
- for system in self.api.systems():
+ #sort the systems
+ system_list = [system for system in self.systems]
+ def sort_name(a,b):
+ return cmp(a.name,b.name)
+ system_list.sort(sort_name)
+
+ for system in system_list:
use_this = False
if systems is not None:
which_systems = systems.split(",")
--
1.5.5.6
From 531ed1da6c17acf1d9492edc8f71ad1bdec36950 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Fri, 23 Jan 2009 10:36:21 +0000
Subject: [PATCH] Fix network configuration broken by addition of bonding support
---
cobbler/action_buildiso.py | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index a6fa735..7fa2c5a 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -236,12 +236,19 @@ class BuildIso:
# add network info to avoid DHCP only if it is available
- if data.has_key("ip_address_eth0") and
data["ip_address_eth0"] != "":
- append_line = append_line + " ip=%s" %
data["ip_address_eth0"]
- if data.has_key("subnet_eth0") and
data["subnet_eth0"] != "":
- append_line = append_line + " netmask=%s" %
data["subnet_eth0"]
- if data.has_key("gateway_eth0") and
data["gateway_eth0"] != "":
- append_line = append_line + " gateway=%s\n" %
data["gateway_eth0"]
+ if data.has_key("bonding_master_eth0") and
data["bonding_master_eth0"] != "":
+ primary_interface = data["bonding_master_eth0"]
+ else:
+ primary_interface = "eth0"
+
+ if data.has_key("ip_address_" + primary_interface) and
data["ip_address_" + primary_interface] != "":
+ append_line = append_line + " ip=%s" %
data["ip_address_" + primary_interface]
+
+ if data.has_key("subnet_" + primary_interface) and
data["subnet_" + primary_interface] != "":
+ append_line = append_line + " netmask=%s" %
data["subnet_" + primary_interface]
+
+ if data.has_key("gateway") and data["gateway"] !=
"":
+ append_line = append_line + " gateway=%s\n" %
data["gateway"]
length=len(append_line)
if length > 254:
--
1.5.5.6