From 99b652303f9e380d0f195f4c3cc1a920c4688b35 Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Tue, 15 Nov 2016 14:25:10 +0100 Subject: [PATCH] addons: bridge/bond: fix ifquery regression where glob and regexes weren't expanded Ticket: Reviewed By: Roopa, Nikhil G Testing Done: auto br0 iface br0 bridge-ports tap17 glob tap[2-4].100 tap19 regex tap2.* Signed-off-by: Julien Fortin --- addons/bond.py | 5 +++++ addons/bridge.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/bond.py b/addons/bond.py index 2e85931..a57872f 100644 --- a/addons/bond.py +++ b/addons/bond.py @@ -361,6 +361,11 @@ class bond(moduleBase): difference = set(slaves).symmetric_difference(runningslaves) if not difference: retslave = 0 + # we want to display the same bond-slaves list as provided + # in the interfaces file but if this list contains regexes or + # globs, for now, we won't try to change it. + if 'regex' in slaves or 'glob' in slaves: + slaves = runningslaves ifaceobjcurr.update_config_with_status('bond-slaves', ' '.join(slaves) if slaves else 'None', retslave) diff --git a/addons/bridge.py b/addons/bridge.py index 8115100..53093cc 100644 --- a/addons/bridge.py +++ b/addons/bridge.py @@ -1385,8 +1385,11 @@ class bridge(moduleBase): ports = None skip_kernel_stp_attrs = 0 - if self.systcl_get_net_bridge_stp_user_space() == '1': - userspace_stp = 1 + try: + if self.systcl_get_net_bridge_stp_user_space() == '1': + userspace_stp = 1 + except Exception as e: + self.logger.info('%s: %s' % (ifaceobjrunning.name, str(e))) tmpbridgeattrdict = self.brctlcmd.get_bridge_attrs(ifaceobjrunning.name) if not tmpbridgeattrdict: @@ -1615,10 +1618,13 @@ class bridge(moduleBase): ).symmetric_difference(bridge_port_list) if not difference: portliststatus = 0 - # we want to display the same bridge-ports list as provided - # in the interfaces file. try: port_list = self._get_ifaceobj_bridge_ports(ifaceobj).split() + # we want to display the same bridge-ports list as provided + # in the interfaces file but if this list contains regexes or + # globs, for now, we won't try to change it. + if 'regex' in port_list or 'glob' in port_list: + port_list = running_port_list except: port_list = running_port_list ifaceobjcurr.update_config_with_status('bridge-ports',