From a39f65634036bc173bcb99120a41447d9ea1bfeb Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Wed, 27 Jun 2018 17:56:48 +0200 Subject: [PATCH] ipa-client-install: enable and start oddjobd if mkhomedir Since the switch to authselect, the service oddjobd is not automatically enabled when ipa client is installed with --mkhomedir. The fix makes sure that the service is enabled/started, and stores the pre-install state in sysrestore.state, in order to revert to the pre-install state when uninstall is called Fixes: https://pagure.io/freeipa/issue/7604 Reviewed-By: Christian Heimes --- ipaclient/install/client.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 72858490d..4b9c9d29f 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -2969,6 +2969,20 @@ def _install(options): statestore=statestore, sudo=options.conf_sudo ) + # if mkhomedir, make sure oddjobd is enabled and started + if options.mkhomedir: + oddjobd = services.service('oddjobd', api) + running = oddjobd.is_running() + enabled = oddjobd.is_enabled() + statestore.backup_state('oddjobd', 'running', running) + statestore.backup_state('oddjobd', 'enabled', enabled) + try: + if not enabled: + oddjobd.enable() + if not running: + oddjobd.start() + except Exception as e: + logger.critical("Unable to start oddjobd: %s", str(e)) logger.info("%s enabled", "SSSD" if options.sssd else "LDAP") @@ -3213,6 +3227,20 @@ def uninstall(options): logger.error( "Failed to remove Kerberos service principals: %s", str(e)) + # Restore oddjobd to its original state + oddjobd = services.service('oddjobd', api) + if not statestore.restore_state('oddjobd', 'running'): + try: + oddjobd.stop() + except Exception: + pass + + if not statestore.restore_state('oddjobd', 'enabled'): + try: + oddjobd.disable() + except Exception: + pass + logger.info("Disabling client Kerberos and LDAP configurations") was_sssd_installed = False was_sshd_configured = False