Re: [Freeipa-devel] [PATCHES 0335-0336] adtrustinstance: Enable and start oddjobd
On Wed, 08 Jul 2015, Tomas Babej wrote: From 66d39f12a77d23e8d8ac2c11650258ed9f3eb200 Mon Sep 17 00:00:00 2001 From: Tomas Babej tba...@redhat.com Date: Wed, 8 Jul 2015 15:44:13 +0200 Subject: [PATCH] adtrustinstance: Enable and start oddjobd Enable and start the oddjobd service as part of the ipa-adtrust-install for the new IPA installations. ACK --- ipaserver/install/adtrustinstance.py | 19 +++ ipaserver/install/installutils.py| 11 +++ 2 files changed, 30 insertions(+) diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py index 8343f81826b661e0ab5a34073b0df9b477589ffa..ff0e8cc3e6dd7a78bd5a6ab06918757ca343970c 100644 --- a/ipaserver/install/adtrustinstance.py +++ b/ipaserver/install/adtrustinstance.py @@ -706,6 +706,9 @@ class ADTRUSTInstance(service.Service): except Exception, e: root_logger.critical(Enabling nsswitch support in slapi-nis failed with error '%s' % e) +def __enable_and_start_oddjobd(self): +installutils.enable_and_start_oddjobd(self.sstore) + def __start(self): try: self.start() @@ -852,6 +855,7 @@ class ADTRUSTInstance(service.Service): self.step(adding Default Trust View, self.__add_default_trust_view) self.step(setting SELinux booleans, \ self.__configure_selinux_for_smbd) +self.step(enabling oddjobd, self.__enable_and_start_oddjobd) self.step(starting CIFS services, self.__start) if self.add_sids: @@ -880,6 +884,21 @@ class ADTRUSTInstance(service.Service): except Exception: pass +# Restore oddjobd to its original state +oddjobd = services.service('oddjobd') + +if not self.sstore.restore_state('oddjobd', 'running'): +try: +oddjobd.stop() +except Exception: +pass + +if not self.sstore.restore_state('oddjobd', 'enabled'): +try: +oddjobd.disable() +except Exception: +pass + # Since we do not guarantee restoring back to working samba state, # we should not restore smb.conf diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 08620c472b9478511d7d08a0d174e7da3f732207..02e8526317dbab909ed48a1823000922ce6e6b7a 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -1081,3 +1081,14 @@ def check_version(): def realm_to_serverid(realm_name): return -.join(realm_name.split(.)) + +def enable_and_start_oddjobd(sstore): +oddjobd = services.service('oddjobd') +sstore.backup_state('oddjobd', 'running', oddjobd.is_running()) +sstore.backup_state('oddjobd', 'enabled', oddjobd.is_enabled()) + +try: +oddjobd.enable() +oddjobd.start() +except Exception as e: +root_logger.critical(Unable to start oddjobd: {0}.format(str(e))) -- 2.1.0 -- / Alexander Bokovoy -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCHES 0335-0336] adtrustinstance: Enable and start oddjobd
On 07/08/2015 05:12 PM, Alexander Bokovoy wrote: On Wed, 08 Jul 2015, Tomas Babej wrote: From 66d39f12a77d23e8d8ac2c11650258ed9f3eb200 Mon Sep 17 00:00:00 2001 From: Tomas Babej tba...@redhat.com Date: Wed, 8 Jul 2015 15:44:13 +0200 Subject: [PATCH] adtrustinstance: Enable and start oddjobd Enable and start the oddjobd service as part of the ipa-adtrust-install for the new IPA installations. ACK Pushed to master: 9c5df3cf76c921d268e7892ef9d9e7a7d2ad89f9 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCHES 0335-0336] adtrustinstance: Enable and start oddjobd
On Wed, 08 Jul 2015, Tomas Babej wrote: From c6135d634cbccbdbb30ab3906c32cd3720bca95e Mon Sep 17 00:00:00 2001 From: Tomas Babej tba...@redhat.com Date: Wed, 8 Jul 2015 15:45:18 +0200 Subject: [PATCH] upgrade: Enable and start oddjobd if adtrust is available If ipa-adtrust-install has already been run on the system, enable and start the oddjobd service. ACK as well. --- install/updates/90-post_upgrade_plugins.update | 1 + ipaserver/install/plugins/adtrust.py | 24 2 files changed, 25 insertions(+) diff --git a/install/updates/90-post_upgrade_plugins.update b/install/updates/90-post_upgrade_plugins.update index 8e8fe09414eac57d2e8c15dcfc4aed64b6e35cd5..3df3a4574705dbd8df8f25149c13877898afb66b 100644 --- a/install/updates/90-post_upgrade_plugins.update +++ b/install/updates/90-post_upgrade_plugins.update @@ -18,3 +18,4 @@ plugin: update_managed_post plugin: update_managed_permissions plugin: update_idrange_baserid plugin: update_passync_privilege_update +plugin: update_oddjobd_for_adtrust diff --git a/ipaserver/install/plugins/adtrust.py b/ipaserver/install/plugins/adtrust.py index d96bfe83e3b9d1d3e64b9fde385fbf520ed20a3a..45bcc5f2fe532446342300ff0c5e1e7149cf023b 100644 --- a/ipaserver/install/plugins/adtrust.py +++ b/ipaserver/install/plugins/adtrust.py @@ -19,8 +19,11 @@ from ipalib import api, errors from ipalib import Updater +from ipaplatform.paths import paths from ipapython.dn import DN from ipapython.ipa_log_manager import * +from ipapython import sysrestore +from ipaserver.install import installutils DEFAULT_ID_RANGE_SIZE = 20 @@ -161,5 +164,26 @@ class update_default_trust_view(Updater): return False, [update] + +class update_oddjobd_for_adtrust(Updater): + +Enables and starts oddjobd daemon if ipa-adtrust-install has been run +on this system. + + +def execute(self, **options): +adtrust_is_enabled = self.api.Command['adtrust_is_enabled']()['result'] + +if adtrust_is_enabled: +self.log.debug('Try to enable and start oddjobd') +sstore = sysrestore.StateFile(paths.SYSRESTORE) +installutils.enable_and_start_oddjobd(sstore) +else: +self.log.debug('ADTrust not configured on this server, do not ' + 'start and enable oddjobd') + +return False, [] + api.register(update_default_range) api.register(update_default_trust_view) +api.register(update_oddjobd_for_adtrust) -- 2.1.0 -- / Alexander Bokovoy -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code