1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

ifupdown2: fix a few regex parsing error messages

Ticket:
Reviewed By: CCR-3804
Testing Done: Tested regex parsing failures

This is mostly a cosmetic fix. we were failing with weird/unclear errors
on unable to parse regex expressions correctly.
This patch mainly adds the interface name to the message and plus adds
an info message showing the actual regex being used in searches.

example config:
{noformat}
auto br-roopa
iface br-roopa
  bridge-vlan-aware yes
  bridge-ports regex '(\\Aswp3\\Z|\\Aswp4\\Z)'
  bridge-pvid 20
{noformat}

before the patch:
warning: br-roopa: error getting dependent interfaces (unbalanced
parenthesis)

after the patch (not pretty but easier to debug)

info: br-roopa: evaluating port expr '['regex', "'(", 'Aswp3', 'Z|',
'Aswp4', "Z)'"]'
warning: br-roopa: error getting dependent interfaces (br-roopa: error
searching regex ''(' in swp38 (unbalanced parenthesis))

(cherry picked from commit bcca6f753a25494666d53f1f2f3c855ffa41d7f0)
This commit is contained in:
Roopa Prabhu
2015-11-15 21:27:07 -08:00
committed by Sam Tannous
parent 2722bb1972
commit 0c8332bc5e
4 changed files with 46 additions and 30 deletions

View File

@@ -122,7 +122,8 @@ class bond(moduleBase):
if not self._is_bond(ifaceobj):
return None
slave_list = self.parse_port_list(ifaceobj.get_attr_value_first(
slave_list = self.parse_port_list(ifaceobj.name,
ifaceobj.get_attr_value_first(
'bond-slaves'), ifacenames_all)
ifaceobj.dependency_type = ifaceDependencyType.MASTER_SLAVE
# Also save a copy for future use
@@ -146,7 +147,7 @@ class bond(moduleBase):
return ifaceobj.priv_data
slaves = ifaceobj.get_attr_value_first('bond-slaves')
if slaves:
return self.parse_port_list(slaves)
return self.parse_port_list(ifaceobj.name, slaves)
else:
return None
@@ -273,7 +274,7 @@ class bond(moduleBase):
attrval = ifaceobj.get_attrs_value_first(['bond-lacp-bypass-priority',
'bond-lacp-fallback-priority'])
if attrval:
portlist = self.parse_port_list(attrval)
portlist = self.parse_port_list(ifaceobj.name, attrval)
if not portlist:
self.log_warn('%s: could not parse \'%s %s\''
%(ifaceobj.name, attrname, attrval))