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 <slaznick@redhat.com>
This commit is contained in:
Martin Basti 2016-10-31 13:27:15 +01:00 committed by Jan Cholasta
parent bbad08900b
commit b3786730e5
2 changed files with 16 additions and 18 deletions

View File

@ -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:

View File

@ -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)