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:
committed by
Sam Tannous
parent
2722bb1972
commit
0c8332bc5e
@ -186,7 +186,8 @@ class mstpctl(moduleBase):
|
||||
def get_dependent_ifacenames(self, ifaceobj, ifacenames_all=None):
|
||||
if not self._is_bridge(ifaceobj):
|
||||
return None
|
||||
return self.parse_port_list(ifaceobj.get_attr_value_first(
|
||||
return self.parse_port_list(ifaceobj.name,
|
||||
ifaceobj.get_attr_value_first(
|
||||
'mstpctl-ports'), ifacenames_all)
|
||||
|
||||
def get_dependent_ifacenames_running(self, ifaceobj):
|
||||
@ -206,7 +207,7 @@ class mstpctl(moduleBase):
|
||||
return port_list
|
||||
ports = ifaceobj.get_attr_value_first('mstpctl-ports')
|
||||
if ports:
|
||||
return self.parse_port_list(ports)
|
||||
return self.parse_port_list(ifaceobj.name, ports)
|
||||
else:
|
||||
return None
|
||||
|
||||
@ -274,7 +275,7 @@ class mstpctl(moduleBase):
|
||||
attrval = ifaceobj.get_attr_value_first(attrname)
|
||||
if not attrval:
|
||||
continue
|
||||
portlist = self.parse_port_list(attrval)
|
||||
portlist = self.parse_port_list(ifaceobj.name, attrval)
|
||||
if not portlist:
|
||||
self.log_warn('%s: error parsing \'%s %s\''
|
||||
%(ifaceobj.name, attrname, attrval))
|
||||
@ -588,7 +589,7 @@ class mstpctl(moduleBase):
|
||||
# <portname>=<portattrvalue>
|
||||
status = 0
|
||||
currstr = ''
|
||||
vlist = self.parse_port_list(v)
|
||||
vlist = self.parse_port_list(ifaceobj.name, v)
|
||||
if not vlist:
|
||||
continue
|
||||
for vlistitem in vlist:
|
||||
|
Reference in New Issue
Block a user