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

continue passing the object to other modules if one of the modules fails

Ticket: CM-4336
Reviewed By:
Testing Done: Tested with the missing port testcase from CM-4336
This commit is contained in:
Roopa Prabhu
2014-12-01 14:54:12 -08:00
parent ef892cccd9
commit 3e6ea735cc
2 changed files with 21 additions and 27 deletions

View File

@@ -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