From b3786730e50080fa4dadeffa86388592c10b3a62 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mon, 31 Oct 2016 13:27:15 +0100 Subject: [PATCH] client: move install cleanup from ipa-client-install to module Cleanup should be part of installation function https://fedorahosted.org/freeipa/ticket/6392 Reviewed-By: Stanislav Laznicka --- client/ipa-client-install | 18 +----------------- ipaclient/install/client.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/client/ipa-client-install b/client/ipa-client-install index 98b2aa165..96aaf9aeb 100755 --- a/client/ipa-client-install +++ b/client/ipa-client-install @@ -240,23 +240,7 @@ def main(): if rval_check != client.SUCCESS: return rval_check - rval = client.install(options) - if rval == client.CLIENT_INSTALL_ERROR: - if options.force: - root_logger.warning( - "Installation failed. Force set so not rolling back changes.") - elif options.on_master: - root_logger.warning( - "Installation failed. As this is IPA server, changes will not " - "be rolled back." - ) - else: - root_logger.error("Installation failed. Rolling back changes.") - options.unattended = True - client.uninstall(options) - - return rval - + return client.install(options) if __name__ == "__main__": try: diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 440475b94..4403283f2 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -2286,7 +2286,21 @@ def install_check(options): def install(options): try: - return _install(options) + rval = _install(options) + if rval == CLIENT_INSTALL_ERROR: + if options.force: + root_logger.warning( + "Installation failed. Force set so not rolling back " + "changes.") + elif options.on_master: + root_logger.warning( + "Installation failed. As this is IPA server, changes will " + "not be rolled back.") + else: + root_logger.error("Installation failed. Rolling back changes.") + options.unattended = True + uninstall(options) + return rval finally: try: os.remove(CCACHE_FILE)