Make Continuous installer continuous only during execution phase

`common.Continuous` class is a basis for uninstallers, which should execute
all the steps regardless of occuring errors. However, we would like the
installer to raise exceptions and return non-zero exit code during validation
phase when some preconditions are not met.

Add a separate exception handler which catches exceptions and logs them as
errors during execution phase only.

https://fedorahosted.org/freeipa/ticket/5725

Reviewed-By: Petr Spacek <pspacek@redhat.com>
This commit is contained in:
Martin Babinsky 2016-09-20 15:15:50 +02:00 committed by Martin Basti
parent e306e8f06d
commit e45bd59b44
2 changed files with 3 additions and 6 deletions

View File

@ -86,9 +86,9 @@ class Interactive(core.Configurable):
class Continuous(core.Configurable):
def _handle_exception(self, exc_info):
def _handle_execute_exception(self, exc_info):
try:
super(Continuous, self)._handle_exception(exc_info)
super(Continuous, self)._handle_execute_exception(exc_info)
except BaseException as e:
self.log.debug(traceback.format_exc())
if isinstance(e, Exception):

View File

@ -375,11 +375,8 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
try:
exc_handler(exc_info)
except BaseException:
raise
else:
break
finally:
self.__transition(running_state, _FAILED)
raise
if self.__state != running_state:
break