diff --git a/addons/mstpctl.py b/addons/mstpctl.py index a36e962..14745cf 100644 --- a/addons/mstpctl.py +++ b/addons/mstpctl.py @@ -245,25 +245,6 @@ class mstpctl(moduleBase): def _apply_bridge_settings(self, ifaceobj): check = False if self.PERFMODE else True try: - bridgeattrs = {k:v for k,v in - {'treeprio' : - ifaceobj.get_attr_value_first('mstpctl-treeprio'), - 'ageing' : - ifaceobj.get_attr_value_first('mstpctl-ageing'), - 'maxage' : - ifaceobj.get_attr_value_first('mstpctl-maxage'), - 'fdelay' : - ifaceobj.get_attr_value_first('mstpctl-fdelay'), - 'maxhops' : - ifaceobj.get_attr_value_first('mstpctl-maxhops'), - 'txholdcount' : - ifaceobj.get_attr_value_first('mstpctl-txholdcount'), - 'forcevers' : - ifaceobj.get_attr_value_first('mstpctl-forcevers'), - 'hello' : - ifaceobj.get_attr_value_first('mstpctl-hello') - }.items() if v} - # set bridge attributes for attrname, dstattrname in self._attrs_map.items(): try: @@ -346,6 +327,10 @@ class mstpctl(moduleBase): for bport in bridgeports: self.logger.info('%s: processing mstp config for port %s' %(ifaceobj.name, bport)) + if not self.ipcmd.link_exists(bport): + self.logger.warn('%s: port %s does not exist' %(ifaceobj.name, + bport)) + continue bportifaceobjlist = ifaceobj_getfunc(bport) if not bportifaceobjlist: continue @@ -604,7 +589,7 @@ class mstpctl(moduleBase): def _query_check_bridge_port(self, ifaceobj, ifaceobjcurr): if not self.ipcmd.link_exists(ifaceobj.name): - self.logger.debug('bridge port %s does not exist' %ifaceobj.name) + #self.logger.debug('bridge port %s does not exist' %ifaceobj.name) ifaceobjcurr.status = ifaceStatus.NOTFOUND return # Check if this is a bridge port @@ -764,6 +749,8 @@ class mstpctl(moduleBase): of interfaces. status is success if the running state is same as user required state in ifaceobj. error otherwise. """ + if ifaceobj.type == ifaceType.BRIDGE_VLAN: + return op_handler = self._run_ops.get(operation) if not op_handler: return diff --git a/ifupdown/scheduler.py b/ifupdown/scheduler.py index 448b332..247bb76 100644 --- a/ifupdown/scheduler.py +++ b/ifupdown/scheduler.py @@ -43,7 +43,7 @@ class ifaceScheduler(): """ Runs sub operation on an interface """ ifacename = ifaceobj.name - if ifupdownobj.type and ifupdownobj.type != ifaceobj.Type: + if ifupdownobj.type and ifupdownobj.type != ifaceobj.type: return if (cls._STATE_CHECK and @@ -76,12 +76,14 @@ class ifaceScheduler(): ifaceobj_getfunc=ifupdownobj.get_ifaceobjs) else: ifupdownobj.logger.debug(msg) - m.run(ifaceobj, op, ifaceobj_getfunc=ifupdownobj.get_ifaceobjs) + m.run(ifaceobj, op, + ifaceobj_getfunc=ifupdownobj.get_ifaceobjs) except Exception, e: - err = 1 - ifupdownobj.log_error(str(e)) - err = 0 # error can be ignored by log_error, in which case - # reset err flag + if not ifupdownobj.ignore_error(str(e)): + err = 1 + ifupdownobj.logger.warn(str(e)) + # Continue with rest of the modules + pass finally: if err or ifaceobj.status == ifaceStatus.ERROR: ifaceobj.set_state_n_status(ifaceState.from_str(op), @@ -89,8 +91,13 @@ class ifaceScheduler(): if 'up' in op or 'down' in op: cls._SCHED_RETVAL = False else: + # Mark success only if the interface was not already + # marked with error + status = (ifaceobj.status + if ifaceobj.status == ifaceStatus.ERROR + else ifaceStatus.SUCCESS) ifaceobj.set_state_n_status(ifaceState.from_str(op), - ifaceStatus.SUCCESS) + status) if ifupdownobj.config.get('addon_scripts_support', '0') == '1': # execute /etc/network/ scripts