URL: https://github.com/freeipa/freeipa/pull/2079 Author: flo-renaud Title: #2079: ipa-client-install: enable and start oddjobd if mkhomedir Action: opened
PR body: """ 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 The commit also add a test. https://pagure.io/freeipa/issue/7604 """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/2079/head:pr2079 git checkout pr2079
From eaeead089179ae1ea34c54c7cec8b2ae048f7bda Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud <f...@redhat.com> Date: Wed, 27 Jun 2018 17:56:48 +0200 Subject: [PATCH 1/2] 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 --- ipaclient/install/client.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 72858490da..c333f4dbaa 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -2969,6 +2969,16 @@ 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) + statestore.backup_state('oddjobd', 'running', oddjobd.is_running()) + statestore.backup_state('oddjobd', 'enabled', oddjobd.is_enabled()) + try: + oddjobd.enable() + 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 +3223,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 From df10aea00e9dbb9ade14097c3c928cbf8ad8b5dc Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud <f...@redhat.com> Date: Wed, 27 Jun 2018 21:03:00 +0200 Subject: [PATCH 2/2] Add test for ticket 7604: ipa-client-install --mkhomedir doesn't enable oddjobd Add a test checking that ipa-client-install --mkhomedir is properly enableing/starting oddjobd. Related to: https://pagure.io/freeipa/issue/7604 --- ipatests/test_integration/test_authselect.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ipatests/test_integration/test_authselect.py b/ipatests/test_integration/test_authselect.py index 06e1cafe48..f4af90e937 100644 --- a/ipatests/test_integration/test_authselect.py +++ b/ipatests/test_integration/test_authselect.py @@ -144,6 +144,8 @@ def test_install_client_preconfigured_profile(self): # Configure a profile winbind with feature with-fingerprint apply_authselect_profile( self.client, preconfigured_profile, preconfigured_options) + # Make sure that oddjobd is disabled and stopped + self.client.run_command(["systemctl", "disable", "oddjobd", "--now"]) # Call the installer, must succeed and store the winbind profile # in the statestore, but install sssd profile with-mkhomedir @@ -155,6 +157,13 @@ def test_install_client_preconfigured_profile(self): check_authselect_profile( self.client, default_profile, ('with-mkhomedir', 'with-sudo')) + # Test for ticket 7604: + # ipa-client-install --mkhomedir doesn't enable oddjobd + # Check that oddjobd has been enabled and started + # because --mkhomedir was used + status = self.client.run_command(["systemctl", "status", "oddjobd"]) + assert "active (running)" in status.stdout_text + def test_uninstall_client_preconfigured_profile(self): """ Test client un-installation when a different profile was present
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/freeipa-devel@lists.fedorahosted.org/message/GESUOBDG736ZP2WC77PJMI3Y56PWE26G/