diff --git a/ifupdown/ifupdownflags.py b/ifupdown/ifupdownflags.py index 4be891a..d76e733 100644 --- a/ifupdown/ifupdownflags.py +++ b/ifupdown/ifupdownflags.py @@ -17,6 +17,7 @@ class ifupdownFlags(): self.PERFMODE = False self.CACHE = False self.WITHDEFAULTS = False + self.IGNORE_ERRORS = False # Flags self.CACHE_FLAGS = 0x0 diff --git a/ifupdown/scheduler.py b/ifupdown/scheduler.py index c79278f..22d32a5 100644 --- a/ifupdown/scheduler.py +++ b/ifupdown/scheduler.py @@ -567,10 +567,21 @@ class ifaceScheduler(): ifupdownobj.logger.info('running upperifaces (parent interfaces) ' + 'if available ..') try: + # upperiface bring up is best effort. + # eg case: if we are bringing up a bridge port + # this section does an 'ifup on the bridge' + # so that the recently up'ed bridge port gets enslaved + # to the bridge. But the up on the bridge may + # throw out more errors if the bridge is not + # in the correct state. Lets not surprise + # the user with such errors when he has + # only requested to bring up the bridge port. cls._STATE_CHECK = False + ifupdownflags.flags.IGNORE_ERRORS = True cls.run_upperifaces(ifupdownobj, ifacenames, ops) - cls._STATE_CHECK = True finally: + ifupdownflags.flags.IGNORE_ERRORS = False + cls._STATE_CHECK = True # upperiface bringup is best effort, so dont propagate errors # reset scheduler status to True cls.set_sched_status(True) diff --git a/ifupdownaddons/modulebase.py b/ifupdownaddons/modulebase.py index 5ca6835..5b7840a 100644 --- a/ifupdownaddons/modulebase.py +++ b/ifupdownaddons/modulebase.py @@ -42,7 +42,7 @@ class moduleBase(object): def log_warn(self, str, ifaceobj=None): """ log a warning if err str is not one of which we should ignore """ - if not self.ignore_error(str): + if not self.ignore_error(str) and not ifupdownflags.flags.IGNORE_ERRORS: if self.logger.getEffectiveLevel() == logging.DEBUG: traceback.print_stack() self.logger.warn(str) @@ -52,7 +52,7 @@ class moduleBase(object): def log_error(self, str, ifaceobj=None, raise_error=True): """ log an err if err str is not one of which we should ignore and raise an exception """ - if not self.ignore_error(str): + if not self.ignore_error(str) and not ifupdownflags.flags.IGNORE_ERRORS: if self.logger.getEffectiveLevel() == logging.DEBUG: traceback.print_stack() if raise_error: