Drop list of return values to be ignored in AdminTool

This was an attempt to suppress client uninstallation failure
messages in the server uninstallation script. This method
inadvertently also suppressed client uninstallation messages and
was generally confusing.

This reverts part of b96906156b

https://pagure.io/freeipa/issue/7836

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
Rob Crittenden
2019-06-04 12:18:46 -04:00
committed by Florence Blanc-Renaud
parent 1d03afc908
commit 1284bf1588
3 changed files with 3 additions and 12 deletions

View File

@@ -62,7 +62,6 @@ ClientInstall = cli.install_tool(
verbose=True, verbose=True,
console_format='%(message)s', console_format='%(message)s',
uninstall_log_file_name=paths.IPACLIENT_UNINSTALL_LOG, uninstall_log_file_name=paths.IPACLIENT_UNINSTALL_LOG,
ignore_return_codes=(client.CLIENT_NOT_CONFIGURED,),
) )

View File

@@ -93,7 +93,6 @@ class AdminTool:
log_file_name = None log_file_name = None
usage = None usage = None
description = None description = None
ignore_return_codes = ()
_option_parsers = dict() _option_parsers = dict()
@@ -184,7 +183,7 @@ class AdminTool:
return_value = exception.rval # pylint: disable=no-member return_value = exception.rval # pylint: disable=no-member
traceback = sys.exc_info()[2] traceback = sys.exc_info()[2]
error_message, return_value = self.handle_error(exception) error_message, return_value = self.handle_error(exception)
if return_value and return_value not in self.ignore_return_codes: if return_value:
self.log_failure(error_message, return_value, exception, self.log_failure(error_message, return_value, exception,
traceback) traceback)
return return_value return return_value

View File

@@ -58,8 +58,7 @@ def _get_usage(configurable_class):
def install_tool(configurable_class, command_name, log_file_name, def install_tool(configurable_class, command_name, log_file_name,
debug_option=False, verbose=False, console_format=None, debug_option=False, verbose=False, console_format=None,
use_private_ccache=True, uninstall_log_file_name=None, use_private_ccache=True, uninstall_log_file_name=None):
ignore_return_codes=()):
""" """
Some commands represent multiple related tools, e.g. Some commands represent multiple related tools, e.g.
``ipa-server-install`` and ``ipa-server-install --uninstall`` would be ``ipa-server-install`` and ``ipa-server-install --uninstall`` would be
@@ -73,8 +72,6 @@ def install_tool(configurable_class, command_name, log_file_name,
:param console_format: logging format for stderr :param console_format: logging format for stderr
:param use_private_ccache: a temporary ccache is created and used :param use_private_ccache: a temporary ccache is created and used
:param uninstall_log_file_name: if not None the log for uninstall :param uninstall_log_file_name: if not None the log for uninstall
:param ignore_return_codes: tuple of error codes to not log errors
for. Let the caller do it if it wants.
""" """
if uninstall_log_file_name is not None: if uninstall_log_file_name is not None:
uninstall_kwargs = dict( uninstall_kwargs = dict(
@@ -84,7 +81,6 @@ def install_tool(configurable_class, command_name, log_file_name,
debug_option=debug_option, debug_option=debug_option,
verbose=verbose, verbose=verbose,
console_format=console_format, console_format=console_format,
ignore_return_codes=ignore_return_codes,
) )
else: else:
uninstall_kwargs = None uninstall_kwargs = None
@@ -102,14 +98,12 @@ def install_tool(configurable_class, command_name, log_file_name,
console_format=console_format, console_format=console_format,
uninstall_kwargs=uninstall_kwargs, uninstall_kwargs=uninstall_kwargs,
use_private_ccache=use_private_ccache, use_private_ccache=use_private_ccache,
ignore_return_codes=ignore_return_codes,
) )
) )
def uninstall_tool(configurable_class, command_name, log_file_name, def uninstall_tool(configurable_class, command_name, log_file_name,
debug_option=False, verbose=False, console_format=None, debug_option=False, verbose=False, console_format=None):
ignore_return_codes=()):
return type( return type(
'uninstall_tool({0})'.format(configurable_class.__name__), 'uninstall_tool({0})'.format(configurable_class.__name__),
(UninstallTool,), (UninstallTool,),
@@ -121,7 +115,6 @@ def uninstall_tool(configurable_class, command_name, log_file_name,
debug_option=debug_option, debug_option=debug_option,
verbose=verbose, verbose=verbose,
console_format=console_format, console_format=console_format,
ignore_return_codes=ignore_return_codes,
) )
) )