From 22802399967fb45057246efac7bc09283f960457 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Thu, 5 Nov 2009 10:03:30 -0500 Subject: Merge IPv6 support patch from Trac #469. Thanks to Jon Sabo. --- AUTHORS | 1 + cobbler/field_info.py | 31 +++--- cobbler/item_system.py | 100 ++++++++++++++++--- snippets/post_install_network_config | 147 +++++++++++++++++++++++----- web/cobbler_web/templates/generic_edit.tmpl | 92 +++++++++++------ 5 files changed, 298 insertions(+), 73 deletions(-) diff --git a/AUTHORS b/AUTHORS index b630ac3f..8680cdab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -66,6 +66,7 @@ Patches and other contributions from: Ben Riggs Jeremy Rosengren Adam Rosenwald + Jon Sabo Christophe Sahut Satoru Satoh Jeff Schroeder diff --git a/cobbler/field_info.py b/cobbler/field_info.py index a0fc4bee..c019731f 100644 --- a/cobbler/field_info.py +++ b/cobbler/field_info.py @@ -58,6 +58,7 @@ USES_CHECKBOX = [ "*netboot_enabled", "netboot_enabled", "*static", + "ipv6_autoconfiguration", "keep_updated", "mirror_locally", "virt_auto_boot" @@ -101,6 +102,7 @@ BLOCK_MAPPINGS = { "broadcast" : "Networking", # .. "reserved" : "Networking", # .. "*mac_address" : "Networking", + "*mtu" : "Networking", "*ip_address" : "Networking", "*dhcp_tag" : "Networking", "*static" : "Networking", @@ -110,17 +112,24 @@ BLOCK_MAPPINGS = { "*dns_name" : "Networking", "*static_routes" : "Networking", "*subnet" : "Networking", - "hostname" : "Networking (Global)", - "gateway" : "Networking (Global)", - "name_servers" : "Networking (Global)", - "name_servers_search" : "Networking (Global)", - "repos" : "General", - "dhcp_tag" : "Advanced", - "mgmt_classes" : "Management", - "template_files" : "Management", - "network_widget_a" : "Networking", - "network_widget_b" : "Networking", - "server" : "Advanced", + "*ipv6_address" : "Networking", + "*ipv6_secondaries" : "Networking", + "*ipv6_mtu" : "Networking", + "*ipv6_static_routes" : "Networking", + "*ipv6_default_gateway" : "Networking", + "hostname" : "Networking (Global)", + "gateway" : "Networking (Global)", + "name_servers" : "Networking (Global)", + "name_servers_search" : "Networking (Global)", + "ipv6_default_device" : "Networking (Global)", + "ipv6_autoconfiguration" : "Networking (Global)", + "repos" : "General", + "dhcp_tag" : "Advanced", + "mgmt_classes" : "Management", + "template_files" : "Management", + "network_widget_a" : "Networking", + "network_widget_b" : "Networking", + "server" : "Advanced", "redhat_management_key" : "Management", "redhat_management_server" : "Management", "createrepo_flags" : "Advanced", diff --git a/cobbler/item_system.py b/cobbler/item_system.py index 419399af..f8a8747f 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -59,9 +59,12 @@ FIELDS = [ ["gateway","",0,"Gateway",True,"",0,"str"], ["name_servers",[],0,"Name Servers",True,"space delimited",0,"list"], ["name_servers_search",[],0,"Name Servers Search Path",True,"space delimited",0,"list"], + ["ipv6_default_device","",0,"IPv6 Default Device",True,"",0,"str"], + ["ipv6_autoconfiguration",False,0,"IPv6 Autoconfiguration",True,"",0,"bool"], ["network_widget_a","",0,"Add Interface",True,"",0,"str"], # not a real field, a marker for the web app ["network_widget_b","",0,"Edit Interface",True,"",0,"str"], # not a real field, a marker for the web app ["*mac_address","",0,"MAC Address",True,"",0,"str"], + ["*mtu","",0,"MTU",True,"",0,"str"], ["*ip_address","",0,"IP Address",True,"",0,"str"], ["*bonding","na",0,"Bonding Mode",True,"",["na","master","slave"],"str"], ["*bonding_master","",0,"Bonding Master",True,"",0,"str"], @@ -72,6 +75,11 @@ FIELDS = [ ["*dns_name","",0,"DNS Name",True,"",0,"str"], ["*static_routes",[],0,"Static Routes",True,"",0,"list"], ["*virt_bridge","",0,"Virt Bridge",True,"",0,"str"], + ["*ipv6_address","",0,"IPv6 Address",True,"",0,"str"], + ["*ipv6_secondaries",[],0,"IPv6 Secondaries",True,"space delimited",0,"list"], + ["*ipv6_mtu","",0,"IPv6 MTU",True,"",0,"str"], + ["*ipv6_static_routes",[],0,"IPv6 Static Routes",True,"",0,"list"], + ["*ipv6_default_gateway","",0,"IPv6 Default Gateway",True,"",0,"str"], ["mgmt_classes",[],0,"Management Classes",True,"For external config management",0,"list"], ["template_files",{},0,"Template Files",True,"File mappings for built-in configuration management",0,"dict"], ["redhat_management_key","<>",0,"Red Hat Management Key",True,"Registration key for RHN, Satellite, or Spacewalk",0,"str"], @@ -113,6 +121,7 @@ class System(item.Item): if not self.interfaces.has_key(name): self.interfaces[name] = { "mac_address" : "", + "mtu" : "", "ip_address" : "", "dhcp_tag" : "", "subnet" : "", @@ -123,6 +132,11 @@ class System(item.Item): "bonding_opts" : "", "dns_name" : "", "static_routes" : [], + "ipv6_address" : "", + "ipv6_secondaries" : [], + "ipv6_mtu" : "", + "ipv6_static_routes" : [], + "ipv6_default_gateway" : "", } return self.interfaces[name] @@ -363,6 +377,63 @@ class System(item.Item): intf["bonding_opts"] = bonding_opts return True + def set_ipv6_autoconfiguration(self,truthiness): + self.ipv6_autoconfiguration = utils.input_boolean(truthiness) + return True + + def set_ipv6_default_device(self,interface_name): + if interface_name is None: + interface_name = "" + self.ipv6_default_device = interface_name + return True + + def set_ipv6_address(self,address,interface): + """ + Assign a IP or hostname in DHCP when this MAC boots. + Only works if manage_dhcp is set in /etc/cobbler/settings + """ + intf = self.__get_interface(interface) + if address == "" or utils.is_ip(address): + intf["ipv6_address"] = address.strip() + return True + raise CX(_("invalid format for IPv6 IP address (%s)") % address) + + def set_ipv6_secondaries(self,addresses,interface): + intf = self.__get_interface(interface) + data = utils.input_string_or_list(addresses) + secondaries = [] + for address in data: + if address == "" or utils.is_ip(address): + secondaries.append(address) + else: + raise CX(_("invalid format for IPv6 IP address (%s)") % address) + + intf["ipv6_secondaries"] = secondaries + return True + + def set_ipv6_default_gateway(self,address,interface): + intf = self.__get_interface(interface) + if address == "" or utils.is_ip(address): + intf["ipv6_default_gateway"] = address.strip() + return True + raise CX(_("invalid format for IPv6 IP address (%s)") % address) + + def set_ipv6_static_routes(self,routes,interface): + intf = self.__get_interface(interface) + data = utils.input_string_or_list(routes) + intf["ipv6_static_routes"] = data + return True + + def set_ipv6_mtu(self,mtu,interface): + intf = self.__get_interface(interface) + intf["ipv6_mtu"] = mtu + return True + + def set_mtu(self,mtu,interface): + intf = self.__get_interface(interface) + intf["mtu"] = mtu + return True + def set_profile(self,profile_name): """ Set the system to use a certain named profile. The profile @@ -503,17 +574,24 @@ class System(item.Item): for (key,value) in hash.iteritems(): (field,interface) = key.split("-") field = field.replace("_","").replace("-","") - if field == "macaddress" : self.set_mac_address(value, interface) - if field == "ipaddress" : self.set_ip_address(value, interface) - if field == "dnsname" : self.set_dns_name(value, interface) - if field == "static" : self.set_static(value, interface) - if field == "dhcptag" : self.set_dhcp_tag(value, interface) - if field == "subnet" : self.set_subnet(value, interface) - if field == "virtbridge" : self.set_virt_bridge(value, interface) - if field == "bonding" : self.set_bonding(value, interface) - if field == "bondingmaster" : self.set_bonding_master(value, interface) - if field == "bondingopts" : self.set_bonding_opts(value, interface) - if field == "staticroutes" : self.set_static_routes(value, interface) + if field == "macaddress" : self.set_mac_address(value, interface) + if field == "mtu" : self.set_mtu(value, interface) + if field == "ipaddress" : self.set_ip_address(value, interface) + if field == "dnsname" : self.set_dns_name(value, interface) + if field == "static" : self.set_static(value, interface) + if field == "dhcptag" : self.set_dhcp_tag(value, interface) + if field == "subnet" : self.set_subnet(value, interface) + if field == "virtbridge" : self.set_virt_bridge(value, interface) + if field == "bonding" : self.set_bonding(value, interface) + if field == "bondingmaster" : self.set_bonding_master(value, interface) + if field == "bondingopts" : self.set_bonding_opts(value, interface) + if field == "staticroutes" : self.set_static_routes(value, interface) + if field == "ipv6address" : self.set_ipv6_address(value, interface) + if field == "ipv6secondaries" : self.set_ipv6_secondaries(value, interface) + if field == "ipv6mtu" : self.set_ipv6_mtu(value, interface) + if field == "ipv6staticroutes" : self.set_ipv6_static_routes(value, interface) + if field == "ipv6defaultgateway" : self.set_ipv6_default_gateway(value, interface) + return True def check_if_valid(self): diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config index 0f349941..c4488c87 100644 --- a/snippets/post_install_network_config +++ b/snippets/post_install_network_config @@ -1,5 +1,6 @@ # Start post_install_network_config generated code #if $getVar("system_name","") != "" + ## this is being provisioned by system records, not profile records ## so we can do the more complex stuff ## get the list of interface names @@ -11,13 +12,17 @@ ## Only physical interfaces are required to have a MAC address ## Also determine the number of bonding devices we have, so we can set the ## max-bonds option in modprobe.conf accordingly. -- jcapel - # + #set $configbymac = True #set $numbondingdevs = 0 + #set $enableipv6 = False + ## ============================================================================= #for $iname in $ikeys + ## look at the interface hash data for the specific interface #set $idata = $interfaces[$iname] + ## do not configure by mac address if we don't have one AND it's not for bonding/vlans ## as opposed to a "real" physical interface #if $idata["mac_address"] == "" and not $vlanpattern.match($iname) and not $idata["bonding"].lower() == "master": @@ -25,11 +30,19 @@ ## use it now #set $configbymac = False #end if + ## count the number of bonding devices we have. #if $idata["bonding"].lower() == "master" #set $numbondingdevs += 1 #end if + + ## enable IPv6 networking if we set an ipv6 address or turn on autoconfiguration + #if $idata["ipv6_address"] != "" or $ipv6_autoconfiguration == True + #set $enableipv6 = True + #end if + #end for + ## end looping through the interfaces to see which ones we need to configure. ## ============================================================================= #set $i = 0 @@ -39,11 +52,13 @@ if [ -f "/etc/modprobe.conf" ]; then echo "options bonding max_bonds=$numbondingdevs" >> /etc/modprobe.conf fi #end if + ## ============================================================================= ## create a staging directory to build out our network scripts into ## make sure we preserve the loopback device mkdir /etc/sysconfig/network-scripts/cobbler cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobbler/ + ## ============================================================================= ## configure the gateway if set up (this is global, not a per-interface setting) #if $gateway != "" @@ -52,6 +67,7 @@ echo "GATEWAY=$gateway" >> /etc/sysconfig/network.cobbler rm -f /etc/sysconfig/network mv /etc/sysconfig/network.cobbler /etc/sysconfig/network #end if + ## ============================================================================= ## Configure the system's primary hostname. This is also passed to anaconda, but ## anaconda doesn't seem to honour it in DHCP-setups. @@ -60,26 +76,63 @@ grep -v HOSTNAME /etc/sysconfig/network > /etc/sysconfig/network.cobbler echo "HOSTNAME=$hostname" >> /etc/sysconfig/network.cobbler rm -f /etc/sysconfig/network mv /etc/sysconfig/network.cobbler /etc/sysconfig/network + # Also set the hostname now, some applications require it (e.g.: if we're # connecting to Puppet before a reboot). /bin/hostname $hostname #end if + + #if $enableipv6 == True +grep -v NETWORKING_IPV6 /etc/sysconfig/network > /etc/sysconfig/network.cobbler +echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network.cobbler +rm -f /etc/sysconfig/network +mv /etc/sysconfig/network.cobbler /etc/sysconfig/network + + #if $ipv6_autoconfiguration != "" +grep -v IPV6_AUTOCONF /etc/sysconfig/network > /etc/sysconfig/network.cobbler + #if $ipv6_autoconfiguration == True +echo "IPV6_AUTOCONF=yes" >> /etc/sysconfig/network.cobbler + #else +echo "IPV6_AUTOCONF=no" >> /etc/sysconfig/network.cobbler + #end if +rm -f /etc/sysconfig/network +mv /etc/sysconfig/network.cobbler /etc/sysconfig/network + #end if + + #if $ipv6_default_device != "" +grep -v IPV6_DEFAULTDEV /etc/sysconfig/network > /etc/sysconfig/network.cobbler +echo "IPV6_DEFAULTDEV=$ipv6_default_device" >> /etc/sysconfig/network.cobbler +rm -f /etc/sysconfig/network +mv /etc/sysconfig/network.cobbler /etc/sysconfig/network + #end if + + #end if + ## ============================================================================= ## now create the config file for each interface #for $iname in $ikeys -# Start configuration for $iname + + # Start configuration for $iname ## create lots of variables to use later - #set $idata = $interfaces[$iname] - #set $mac = $idata["mac_address"].upper() - #set $static = $idata["static"] - #set $ip = $idata["ip_address"] - #set $netmask = $idata["subnet"] - #set $static_routes = $idata["static_routes"] - #set $bonding = $idata["bonding"] - #set $bonding_master = $idata["bonding_master"] - #set $bonding_opts = $idata["bonding_opts"] - #set $devfile = "/etc/sysconfig/network-scripts/cobbler/ifcfg-" + $iname - #set $routesfile = "/etc/sysconfig/network-scripts/cobbler/route-" + $iname + #set $idata = $interfaces[$iname] + #set $mac = $idata["mac_address"].upper() + #set $mtu = $idata["mtu"] + #set $static = $idata["static"] + #set $ip = $idata["ip_address"] + #set $netmask = $idata["subnet"] + #set $static_routes = $idata["static_routes"] + #set $bonding = $idata["bonding"] + #set $bonding_master = $idata["bonding_master"] + #set $bonding_opts = $idata["bonding_opts"] + #set $ipv6_address = $idata["ipv6_address"] + #set $ipv6_secondaries = $idata["ipv6_secondaries"] + #set $ipv6_mtu = $idata["ipv6_mtu"] + #set $ipv6_default_gateway = $idata["ipv6_default_gateway"] + #set $ipv6_static_routes = $idata["ipv6_static_routes"] + #set $devfile = "/etc/sysconfig/network-scripts/cobbler/ifcfg-" + $iname + #set $routesfile = "/etc/sysconfig/network-scripts/cobbler/route-" + $iname + #set $ipv6_routesfile = "/etc/sysconfig/network-scripts/cobbler/route6-" + $iname + ## determine if this interface is for a VLAN #if $vlanpattern.match($iname) ## If this is a VLAN interface, skip it, anaconda doesn't know @@ -88,6 +141,7 @@ mv /etc/sysconfig/network.cobbler /etc/sysconfig/network #else #set $is_vlan = "false" #end if + ## if this is a bonded interface, configure it in modprobe.conf #if $bonding.lower() == "master" #if $osversion == "rhel4" @@ -101,6 +155,7 @@ if [ -f "/etc/modprobe.conf" ]; then fi #end if #end if + #if $configbymac and $is_vlan == "false" and $bonding.lower() != "master" ## This is the code path physical interfaces will follow. ## Get the current interface name @@ -140,10 +195,30 @@ echo "NETMASK=$netmask" >> $devfile ## we don't have enough info for static configuration echo "BOOTPROTO=none" >> $devfile #end if + #if $enableipv6 == True and $ipv6_autoconfiguration == False + #if $ipv6_address != "" +echo "IPV6INIT=yes" >> $devfile +echo "IPV6ADDR=$ipv6_address" >> $devfile + #end if + #if $ipv6_secondaries != "" + #set ipv6_secondaries = ' '.join(ipv6_secondaries) + ## The quotes around the ipv6 ip's need to be here +echo 'IPV6ADDR_SECONDARIES="$ipv6_secondaries"' >> $devfile + #end if + #if $ipv6_mtu != "" +echo "IPV6MTU=$ipv6_mtu" >> $devfile + #end if + #if $ipv6_default_gateway != "" +echo "IPV6_DEFAULTGW=$ipv6_default_gateway" >> $devfile + #end if + #end if #else ## this is a DHCP interface, much less work to do echo "BOOTPROTO=dhcp" >> $devfile #end if + #if $mtu != "" +echo "MTU=$mtu" >> $devfile + #end if #else if $is_vlan == "true" or $bonding.lower() == "master" ## Handle non-physical interfaces with special care. :) echo "# Cobbler generated non-physical interface" > $devfile @@ -178,6 +253,9 @@ echo "BOOTPROTO=none" >> $devfile #else echo "BOOTPROTO=dhcp" >> $devfile #end if + #if $mtu != "" +echo "MTU=$mtu" >> $devfile + #end if #else if $configbymac == False ## We'll end up here when not all physical interfaces present for ## this system have MAC-addresses configured for them. We don't @@ -214,10 +292,14 @@ echo "BOOTPROTO=none" >> $devfile ## this is a DHCP interface, much less work to do echo "BOOTPROTO=dhcp" >> $devfile #end if + #if $mtu != "" +echo "MTU=$mtu" >> $devfile + #end if #else # If you end up here, please mail the list... This shouldn't # happen. ;-) -- jcapel #end if + ## If the interface is anything but a slave then add DNSn entry #if $bonding.lower() != "slave" #set $nct = 0 @@ -225,25 +307,42 @@ echo "BOOTPROTO=dhcp" >> $devfile #set $nct = $nct + 1 echo "DNS$nct=$nameserver" >> $devfile #end for - #end if - #for $route in $static_routes - #set routepattern = $re.compile("[0-9/.]+:[0-9.]+") - #if $routepattern.match($route) - #set $routebits = $route.split(":") - #set [$network, $router] = $route.split(":") + #end if + + #for $route in $static_routes + #set routepattern = $re.compile("[0-9/.]+:[0-9.]+") + #if $routepattern.match($route) + #set $routebits = $route.split(":") + #set [$network, $router] = $route.split(":") echo "$network via $router" >> $routesfile - #else + #else + # Warning: invalid route "$route" + #end if + #end for + + #if $enableipv6 == True + #for $route in $ipv6_static_routes + #set routepattern = $re.compile("[0-9a-fA-F:/]+,[0-9a-fA-F:]+") + #if $routepattern.match($route) + #set $routebits = $route.split(",") + #set [$network, $router] = $route.split(",") +echo "$network via $router dev $iname" >> $ipv6_routesfile + #else # Warning: invalid route "$route" #end if - #end for + #end for + #end if + #set $i = $i + 1 -# End configuration for $iname + + # End configuration for $iname #end for + ## ============================================================================= ## Configure name server search path in /etc/resolv.conf #set $num_ns = $len($name_servers) #set $num_ns_search = $len($name_servers_search) - #if $num_ns_search > 0 + #if $num_ns_search > 0 sed -i -e "/^search /d" /etc/resolv.conf echo -n "search " >>/etc/resolv.conf #for $nameserversearch in $name_servers_search @@ -251,6 +350,7 @@ echo -n "$nameserversearch " >>/etc/resolv.conf #end for echo "" >>/etc/resolv.conf #end if + ## ============================================================================= ## Configure name servers in /etc/resolv.conf #if $num_ns > 0 @@ -259,6 +359,7 @@ sed -i -e "/^nameserver /d" /etc/resolv.conf echo "nameserver $nameserver" >>/etc/resolv.conf #end for #end if + ## Move all staged files to their final location rm -f /etc/sysconfig/network-scripts/ifcfg-* mv /etc/sysconfig/network-scripts/cobbler/* /etc/sysconfig/network-scripts/ diff --git a/web/cobbler_web/templates/generic_edit.tmpl b/web/cobbler_web/templates/generic_edit.tmpl index d45408cd..d8b24a0f 100644 --- a/web/cobbler_web/templates/generic_edit.tmpl +++ b/web/cobbler_web/templates/generic_edit.tmpl @@ -39,6 +39,12 @@ function intf_update_visibility() intf_enable_field("virt_bridge",!is_master) intf_enable_field("bonding_opts",is_master) intf_enable_field("bonding_master",is_slave) + intf_enable_field("mtu",!is_slave) + intf_enable_field("ipv6_address",!is_slave) + intf_enable_field("ipv6_secondaries",!is_slave) + intf_enable_field("ipv6_mtu",!is_slave) + intf_enable_field("ipv6_static_routes",!is_slave) + intf_enable_field("ipv6_default_gateway",!is_slave) } function get_selected_interface() @@ -107,6 +113,12 @@ function on_interface_add() interface_table[iname]["static"] = false interface_table[iname]["present"] = "1" interface_table[iname]["original"] = "0" + interface_table[iname]["mtu"] = "" + interface_table[iname]["ipv6_address"] = "" + interface_table[iname]["ipv6_secondaries"] = "" + interface_table[iname]["ipv6_mtu"] = "" + interface_table[iname]["ipv6_static_routes"] = "" + interface_table[iname]["ipv6_default_gateway"] = "" var interfaces = document.getElementById("interfaces") ilen = interfaces.length @@ -197,7 +209,12 @@ function save_intf(which) itable["virt_bridge"] = get_enabled_field("virt_bridge",!is_master) itable["present"] = document.getElementById("present").value itable["original"] = document.getElementById("original").value - + itable["mtu"] = get_enabled_field("mtu",!is_slave) + itable["ipv6_address"] = get_enabled_field("ipv6_address",!is_slave) + itable["ipv6_secondaries"] = get_enabled_field("ipv6_secondaries",!is_slave) + itable["ipv6_mtu"] = get_enabled_field("ipv6_mtu",!is_slave) + itable["ipv6_static_routes"] = get_enabled_field("ipv6_static_routes",!is_slave) + itable["ipv6_default_gateway"] = get_enabled_field("ipv6_default_gateway",!is_slave) } function load_intf() @@ -219,7 +236,13 @@ function load_intf() document.getElementById("virt_bridge").value = interface_table[intf]["virt_bridge"] document.getElementById("present").value = interface_table[intf]["present"] document.getElementById("original").value = interface_table[intf]["original"] - + document.getElementById("mtu").value = interface_table[intf]["mtu"] + document.getElementById("ipv6_address").value = interface_table[intf]["ipv6_address"] + document.getElementById("ipv6_secondaries").value = interface_table[intf]["ipv6_secondaries"] + document.getElementById("ipv6_mtu").value = interface_table[intf]["ipv6_mtu"] + document.getElementById("ipv6_static_routes").value = interface_table[intf]["ipv6_static_routes"] + document.getElementById("ipv6_default_gateway").value = interface_table[intf]["ipv6_default_gateway"] + intf_update_visibility() } @@ -227,19 +250,26 @@ function clear_intf() { // this clears the interface list and populates it with the currently selected interface data - document.getElementById("mac_address").value = "" - document.getElementById("bonding").value = "na" - document.getElementById("bonding_master").value = "" - document.getElementById("bonding_opts").value = "" - document.getElementById("static").checked = true - document.getElementById("ip_address").value = "" - document.getElementById("subnet").value = "" - document.getElementById("dns_name").value = "" - document.getElementById("static_routes").value = "" - document.getElementById("dhcp_tag").value = "" - document.getElementById("virt_bridge").value = "" - document.getElementById("present").value = "1" - document.getElementById("original").value = "0" + document.getElementById("mac_address").value = "" + document.getElementById("bonding").value = "na" + document.getElementById("bonding_master").value = "" + document.getElementById("bonding_opts").value = "" + document.getElementById("static").checked = true + document.getElementById("ip_address").value = "" + document.getElementById("subnet").value = "" + document.getElementById("dns_name").value = "" + document.getElementById("static_routes").value = "" + document.getElementById("dhcp_tag").value = "" + document.getElementById("virt_bridge").value = "" + document.getElementById("present").value = "1" + document.getElementById("original").value = "0" + document.getElementById("mtu").value = "" + document.getElementById("ipv6_address").value = "" + document.getElementById("ipv6_secondaries").value = "" + document.getElementById("ipv6_mtu").value = "" + document.getElementById("ipv6_static_routes").value = "" + document.getElementById("ipv6_default_gateway").value = "" + } @@ -253,19 +283,25 @@ function build_interface_table() var ifound = 0 {% for key,value in interfaces.items %} interface_table['{{ key }}'] = new Array() - interface_table['{{ key }}']["mac_address"] = "{{ value.mac_address }}" - interface_table['{{ key }}']["bonding"] = "{{ value.bonding }}" - interface_table['{{ key }}']["bonding_master"] = "{{ value.bonding_master }}" - interface_table['{{ key }}']["bonding_opts"] = "{{ value.bonding_opts }}" - interface_table['{{ key }}']["static"] = {{ value.static|lower }} - interface_table['{{ key }}']["ip_address"] = "{{ value.ip_address }}" - interface_table['{{ key }}']["subnet"] = "{{ value.subnet }}" - interface_table['{{ key }}']["dns_name"] = "{{ value.dns_name }}" - interface_table['{{ key }}']["static_routes"] = "{{ value.static_routes|join:" " }}" - interface_table['{{ key }}']["dhcp_tag"] = "{{ value.dhcp_tag }}" - interface_table['{{ key }}']["virt_bridge"] = "{{ value.virt_bridge }}" - interface_table['{{ key }}']["present"] = "1" - interface_table['{{ key }}']["original"] = "1" + interface_table['{{ key }}']["mac_address"] = "{{ value.mac_address }}" + interface_table['{{ key }}']["bonding"] = "{{ value.bonding }}" + interface_table['{{ key }}']["bonding_master"] = "{{ value.bonding_master }}" + interface_table['{{ key }}']["bonding_opts"] = "{{ value.bonding_opts }}" + interface_table['{{ key }}']["static"] = {{ value.static|lower }} + interface_table['{{ key }}']["ip_address"] = "{{ value.ip_address }}" + interface_table['{{ key }}']["subnet"] = "{{ value.subnet }}" + interface_table['{{ key }}']["dns_name"] = "{{ value.dns_name }}" + interface_table['{{ key }}']["static_routes"] = "{{ value.static_routes|join:" " }}" + interface_table['{{ key }}']["dhcp_tag"] = "{{ value.dhcp_tag }}" + interface_table['{{ key }}']["virt_bridge"] = "{{ value.virt_bridge }}" + interface_table['{{ key }}']["present"] = "1" + interface_table['{{ key }}']["original"] = "1" + interface_table['{{ key }}']["mtu"] = "{{ value.mtu }}" + interface_table['{{ key }}']["ipv6_address"] = "{{ value.ipv6_address }}" + interface_table['{{ key }}']["ipv6_secondaries"] = "{{ value.ipv6_secondaries|join:" " }}" + interface_table['{{ key }}']["ipv6_mtu"] = "{{ value.ipv6_mtu }}" + interface_table['{{ key }}']["ipv6_static_routes"] = "{{ value.ipv6_static_routes|join:" " }}" + interface_table['{{ key }}']["ipv6_default_gateway"] = "{{ value.ipv6_default_gateway }}" last = "{{ key }}" {% endfor %} {% endsmart_if %} -- cgit