summaryrefslogtreecommitdiffstats
path: root/cobbler/item_system.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-10-08 16:39:41 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-10-08 16:39:41 -0400
commit0b56b91457c3c6002c12c7cff15a08ce3e695e6a (patch)
tree51e9384ee9d468d7f462f1713686085c7cb62dfc /cobbler/item_system.py
parentdd19b31fc9367592dd2e00c02757db05182c1aba (diff)
downloadthird_party-cobbler-0b56b91457c3c6002c12c7cff15a08ce3e695e6a.tar.gz
third_party-cobbler-0b56b91457c3c6002c12c7cff15a08ce3e695e6a.tar.xz
third_party-cobbler-0b56b91457c3c6002c12c7cff15a08ce3e695e6a.zip
More work on the new multi-NIC code. Largely working at this point, sync has
been updated, and backwards compatibility (upgrades) have been tested. Koan still has to be modified and tested, and templating still needs to be tested.
Diffstat (limited to 'cobbler/item_system.py')
-rw-r--r--cobbler/item_system.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index 1a130f3..ae1b7a5 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -81,9 +81,7 @@ class System(item.Item):
# now backfill the interface structure with any old values
# backwards compatibility here is complex/ugly though we don't want to
# break anyone. So this code needs to stay here.
- if __hostname is not None or
- __mac_address is not None or
- __ip_address is not None:
+ if len(self.interfaces) == 0 and (__hostname is not None or __mac_address is not None or __ip_address is not None):
insert_item = {}
if __hostname is not None and __hostname != "":
insert_item["hostname"] = __hostname
@@ -97,16 +95,19 @@ class System(item.Item):
# now if no interfaces are STILL defined, add in one only under certain
# conditions .. this emulates legacy behavior in the new interface format
- if __mac_address == "" and utils.is_mac(self.name):
- self.interfaces.append({
- "mac_address" : self.name
- })
- elif __ip_address == "" and utils.is_ip(self.name):
- self.interfaces.append({
- "ip_address" : self.ip_address
- })
+ # FIXME: the following may be a bit ...quirky
+ else:
+ if __mac_address == "" and utils.is_mac(self.name):
+ self.interfaces.append({
+ "mac_address" : self.name
+ })
+ elif __ip_address == "" and utils.is_ip(self.name):
+ self.interfaces.append({
+ "ip_address" : self.ip_address
+ })
# now for each interface, if any fields are missing, add them.
+ # if any new interface fields are ever added, they must be duplicated here.
for x in self.interfaces:
x.setdefault("mac_address","")
x.setdefault("ip_address","")
@@ -391,16 +392,15 @@ class System(item.Item):
counter = 0
for x in self.interfaces:
- buf = buf + _(" -----------\n")
- buf = buf + _("interface : #%d\n") % counter + 1
- buf = buf + _(" mac address : %s\n") % x.get("mac_address","")
- buf = buf + _(" ip address : %s\n") % x.get("ip_address","")
- buf = buf + _(" hostname : %s\n") % x.get("hostname","")
- buf = buf + _(" gateway : %s\n") % x.get("gateway","")
- buf = buf + _(" subnet : %s\n") % x.get("subnet","")
- buf = buf + _(" virt bridge : %s\n") % x.get("virt_bridge","")
- buf = buf + _(" dhcp tag : %s\n") % x.get("dhcp_tag","")
- buf = buf + _(" config id : %s\n") % utils.get_config_filename(self,counter)
+ buf = buf + _("interface : #%s\n") % (counter)
+ buf = buf + _(" mac address : %s\n") % x.get("mac_address","")
+ buf = buf + _(" ip address : %s\n") % x.get("ip_address","")
+ buf = buf + _(" hostname : %s\n") % x.get("hostname","")
+ buf = buf + _(" gateway : %s\n") % x.get("gateway","")
+ buf = buf + _(" subnet : %s\n") % x.get("subnet","")
+ buf = buf + _(" virt bridge : %s\n") % x.get("virt_bridge","")
+ buf = buf + _(" dhcp tag : %s\n") % x.get("dhcp_tag","")
+ buf = buf + _(" config id : %s\n") % utils.get_config_filename(self,counter)
counter = counter + 1