]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
exit with non-zero return code if any of the ifaces have errors
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Wed, 2 Jul 2014 17:03:02 +0000 (10:03 -0700)
committerRoopa Prabhu <roopa@cumulusnetworks.com>
Wed, 2 Jul 2014 17:03:02 +0000 (10:03 -0700)
Ticket: CM-2960
Reviewed By:
Testing Done: ifupdown2 sanity + error cases + precommit

uses a class variable to store return value

pkg/scheduler.py

index 4ab76369a220f35e020c899fd3eed54581f22fc0..4f8e366904cd4b6e72ed4e81563ac24a9c14e048 100644 (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()