]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
Make ifupdown2 insensitive to '-' and '_' in interface attribute names.
authorroopa <roopa@cumulusnetworks.com>
Mon, 7 Apr 2014 21:38:06 +0000 (14:38 -0700)
committerroopa <roopa@cumulusnetworks.com>
Mon, 7 Apr 2014 21:38:06 +0000 (14:38 -0700)
Ticket: CM-2501
Reviewed By:
Testing Done: Tested ifupdown sanity

pkg/ifupdownmain.py
pkg/networkinterfaces.py

index c72c23213a93d89b73bea181193c893e36c6564b..b37a4fedfc1cd8f8717932a72fe9b9150f67166c 100644 (file)
@@ -118,8 +118,6 @@ class ifupdownMain(ifupdownBase):
         self.STATEMANAGER_ENABLE = statemanager_enable
         self.CACHE = cache
 
-        self.logger.debug("Roopa: DRYRUN = %s" %self.DRYRUN)
-
         # Can be used to provide hints for caching
         self.CACHE_FLAGS = 0x0
         self._DELETE_DEPENDENT_IFACES_WITH_NOCONFIG = False
index 4992d6be79fc1734edbb5d363f406123d48e5c1c..9635e50120c3accf2ce0bec3f4aa96661fc45c33 100644 (file)
@@ -96,8 +96,9 @@ class networkInterfaces():
         return 0
 
     def _add_to_iface_config(self, iface_config, attrname, attrval):
-        attrvallist = iface_config.get(attrname, [])
-        if attrname in ['scope', 'netmask', 'broadcast', 'preferred-lifetime']:
+        newattrname = attrname.replace("_", "-")
+        attrvallist = iface_config.get(newattrname, [])
+        if newattrname in ['scope', 'netmask', 'broadcast', 'preferred-lifetime']:
             # For attributes that are related and that can have multiple
             # entries, store them at the same index as their parent attribute.
             # 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):
                     attrvallist.append('')
                 attrvallist.append(attrval)
-                iface_config[attrname] = attrvallist
+                iface_config[newattrname] = attrvallist
         elif not attrvallist:
-            iface_config[attrname] = [attrval]
+            iface_config[newattrname] = [attrval]
         else:
-            iface_config[attrname].append(attrval)
+            iface_config[newattrname].append(attrval)
 
     def process_iface(self, lines, cur_idx, lineno):
         lines_consumed = 0
         line_idx = cur_idx
 
         ifaceobj = iface()
-
         iface_line = lines[cur_idx].strip('\n ')
         iface_attrs = iface_line.split()
         ifacename = iface_attrs[1]