mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Check for duplicate interfaces
Ticket: CM-2509 Reviewed By: Testing Done: Tested interfaces file with duplicate entries Old ifupdown allowed multiple stanza's for the same interface. To support older files ifupdown2 will continue to support duplicate interfaces. However this check will warn on interfaces with same config more than once. The check is done at a higher level during parsing and hence only does a string compare of the iface section.
This commit is contained in:
@@ -325,8 +325,16 @@ class ifupdownMain(ifupdownBase):
|
||||
self.dependency_graph[i] = dlist
|
||||
|
||||
def _save_iface(self, ifaceobj):
|
||||
self.ifaceobjdict.setdefault(ifaceobj.name,
|
||||
[]).append(ifaceobj)
|
||||
currentifaceobjlist = self.ifaceobjdict.get(ifaceobj.name)
|
||||
if not currentifaceobjlist:
|
||||
self.ifaceobjdict[ifaceobj.name]= [ifaceobj]
|
||||
return
|
||||
|
||||
if ifaceobj.compare(currentifaceobjlist[0]):
|
||||
self.logger.warn('duplicate interface %s found' %ifaceobj.name)
|
||||
return
|
||||
|
||||
self.ifaceobjdict[ifaceobj.name].append(ifaceobj)
|
||||
|
||||
def _module_syntax_checker(self, attrname, attrval):
|
||||
for m, mdict in self.module_attrs.items():
|
||||
|
Reference in New Issue
Block a user