mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Make ifupdown2 insensitive to '-' and '_' in interface attribute names.
Ticket: CM-2501 Reviewed By: Testing Done: Tested ifupdown sanity
This commit is contained in:
@@ -118,8 +118,6 @@ class ifupdownMain(ifupdownBase):
|
|||||||
self.STATEMANAGER_ENABLE = statemanager_enable
|
self.STATEMANAGER_ENABLE = statemanager_enable
|
||||||
self.CACHE = cache
|
self.CACHE = cache
|
||||||
|
|
||||||
self.logger.debug("Roopa: DRYRUN = %s" %self.DRYRUN)
|
|
||||||
|
|
||||||
# Can be used to provide hints for caching
|
# Can be used to provide hints for caching
|
||||||
self.CACHE_FLAGS = 0x0
|
self.CACHE_FLAGS = 0x0
|
||||||
self._DELETE_DEPENDENT_IFACES_WITH_NOCONFIG = False
|
self._DELETE_DEPENDENT_IFACES_WITH_NOCONFIG = False
|
||||||
|
@@ -96,8 +96,9 @@ class networkInterfaces():
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
def _add_to_iface_config(self, iface_config, attrname, attrval):
|
def _add_to_iface_config(self, iface_config, attrname, attrval):
|
||||||
attrvallist = iface_config.get(attrname, [])
|
newattrname = attrname.replace("_", "-")
|
||||||
if attrname in ['scope', 'netmask', 'broadcast', 'preferred-lifetime']:
|
attrvallist = iface_config.get(newattrname, [])
|
||||||
|
if newattrname in ['scope', 'netmask', 'broadcast', 'preferred-lifetime']:
|
||||||
# For attributes that are related and that can have multiple
|
# For attributes that are related and that can have multiple
|
||||||
# entries, store them at the same index as their parent attribute.
|
# entries, store them at the same index as their parent attribute.
|
||||||
# The example of such attributes is 'address' and its related
|
# The example of such attributes is 'address' and its related
|
||||||
@@ -113,18 +114,17 @@ class networkInterfaces():
|
|||||||
for i in range(0, len(addrlist) - len(attrvallist) -1):
|
for i in range(0, len(addrlist) - len(attrvallist) -1):
|
||||||
attrvallist.append('')
|
attrvallist.append('')
|
||||||
attrvallist.append(attrval)
|
attrvallist.append(attrval)
|
||||||
iface_config[attrname] = attrvallist
|
iface_config[newattrname] = attrvallist
|
||||||
elif not attrvallist:
|
elif not attrvallist:
|
||||||
iface_config[attrname] = [attrval]
|
iface_config[newattrname] = [attrval]
|
||||||
else:
|
else:
|
||||||
iface_config[attrname].append(attrval)
|
iface_config[newattrname].append(attrval)
|
||||||
|
|
||||||
def process_iface(self, lines, cur_idx, lineno):
|
def process_iface(self, lines, cur_idx, lineno):
|
||||||
lines_consumed = 0
|
lines_consumed = 0
|
||||||
line_idx = cur_idx
|
line_idx = cur_idx
|
||||||
|
|
||||||
ifaceobj = iface()
|
ifaceobj = iface()
|
||||||
|
|
||||||
iface_line = lines[cur_idx].strip('\n ')
|
iface_line = lines[cur_idx].strip('\n ')
|
||||||
iface_attrs = iface_line.split()
|
iface_attrs = iface_line.split()
|
||||||
ifacename = iface_attrs[1]
|
ifacename = iface_attrs[1]
|
||||||
|
Reference in New Issue
Block a user