details = prepDetails(interface, hostname)
+ if interface['is_primary']:
+ gateway = interface['gateway']
+
if 'interface_tag_ids' in interface:
version = 4.3
interface_tag_ids = "interface_tag_ids"
elif orig_ifname:
ifname = orig_ifname
device_id -= 1
- if 'PRIMARY' in details: del details['PRIMARY']
logger.log('net:InitInterfaces: Bridge detected. Adding %s to devices_map' % ifname)
- devices_map[ifname] = details
+ devices_map[ifname] = removeBridgedIfaceDetails(details)
bridgeName = details['BRIDGE']
logger.log('net:InitInterfaces: Adding bridge %s' % bridgeName)
details['NETMASK'] = interface['netmask']
details['GATEWAY'] = interface['gateway']
if interface['is_primary']:
- gateway = interface['gateway']
if interface['dns1']:
details['DNS1'] = interface['dns1']
if interface['dns2']:
return details
+##
+# Remove duplicate entry from the bridged interface's configuration file.
+#
+def removeBridgedIfaceDetails(details):
+ for key in [ 'PRIMARY', 'PERSISTENT_DHCLIENT', 'DHCLIENTARGS', 'DHCP_HOSTNAME',
+ 'BOOTPROTO', 'IPADDR', 'NETMASK', 'GATEWAY', 'DNS1', 'DNS2' ]:
+ if key in details:
+ del details[key]
+ return details
+
if __name__ == "__main__":
import optparse
import sys