From 2f4b3972a04e3ebf99ea7fd51c2b102cc8342582 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 23 Nov 2011 16:52:40 -0500 Subject: Add plugin framework to LDAP updates. There are two reasons for the plugin framework: 1. To provide a way of doing manual/complex LDAP changes without having to keep extending ldapupdate.py (like we did with managed entries). 2. Allows for better control of restarts. There are two types of plugins, preop and postop. A preop plugin runs before any file-based updates are loaded. A postop plugin runs after all file-based updates are applied. A preop plugin may update LDAP directly or craft update entries to be applied with the file-based updates. Either a preop or postop plugin may attempt to restart the dirsrv instance. The instance is only restartable if ipa-ldap-updater is being executed as root. A warning is printed if a restart is requested for a non-root user. Plugins are not executed by default. This is so we can use ldapupdate to apply simple updates in commands like ipa-nis-manage. https://fedorahosted.org/freeipa/ticket/1789 https://fedorahosted.org/freeipa/ticket/1790 https://fedorahosted.org/freeipa/ticket/2032 --- ipaserver/install/upgradeinstance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ipaserver/install/upgradeinstance.py') diff --git a/ipaserver/install/upgradeinstance.py b/ipaserver/install/upgradeinstance.py index 72636497..0913fdb4 100644 --- a/ipaserver/install/upgradeinstance.py +++ b/ipaserver/install/upgradeinstance.py @@ -21,6 +21,7 @@ import os import sys import shutil import random +import traceback from ipapython.ipa_log_manager import * from ipaserver.install import installutils @@ -100,11 +101,12 @@ class IPAUpgrade(service.Service): def __upgrade(self): try: - ld = ldapupdate.LDAPUpdate(dm_password='', ldapi=True, live_run=self.live_run) + ld = ldapupdate.LDAPUpdate(dm_password='', ldapi=True, live_run=self.live_run, plugins=True) if len(self.files) == 0: self.files = ld.get_all_files(ldapupdate.UPDATES_DIR) self.modified = ld.update(self.files) - except ldapupdate.BadSyntax: + except ldapupdate.BadSyntax, e: + logging.error('Bad syntax in upgrade %s' % str(e)) self.modified = False self.badsyntax = True except Exception, e: @@ -112,6 +114,7 @@ class IPAUpgrade(service.Service): self.modified = False self.upgradefailed = True root_logger.error('Upgrade failed with %s' % str(e)) + root_logger.debug('%s', traceback.format_exc()) def main(): if os.getegid() != 0: -- cgit