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

exit with non-zero return code if any of the ifaces have errors

Ticket: CM-2960
Reviewed By:
Testing Done: ifupdown2 sanity + error cases + precommit

uses a class variable to store return value
This commit is contained in:
Roopa Prabhu
2014-07-02 10:03:02 -07:00
parent 1d787a1775
commit 1104a8609e

View File

@ -48,14 +48,15 @@ class ifaceScheduler():
_STATE_CHECK = True
_SCHED_RETVAL = True
@classmethod
def run_iface_op(cls, ifupdownobj, ifaceobj, op, cenv=None):
""" Runs sub operation on an interface """
ifacename = ifaceobj.name
if (cls._STATE_CHECK and
(ifaceobj.state >= ifaceState.from_str(op)) and
(ifaceobj.status == ifaceStatus.SUCCESS)):
(ifaceobj.state >= ifaceState.from_str(op))):
ifupdownobj.logger.debug('%s: already in state %s' %(ifacename, op))
return
if not ifupdownobj.ADDONS_ENABLE: return
@ -84,6 +85,8 @@ class ifaceScheduler():
if err:
ifaceobj.set_state_n_status(ifaceState.from_str(op),
ifaceStatus.ERROR)
if 'up' in op or 'down' in op:
cls._SCHED_RETVAL = False
else:
ifaceobj.set_state_n_status(ifaceState.from_str(op),
ifaceStatus.SUCCESS)
@ -423,3 +426,6 @@ class ifaceScheduler():
cls.run_iface_list_upper(ifupdownobj, ifacenames, ops,
skip_root=True)
cls._STATE_CHECK = True
if not cls._SCHED_RETVAL:
raise Exception()