diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-05-27 11:58:31 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-06-01 09:52:10 -0400 |
commit | b29de6bf27a51904adfdfb6cf918903f80e4c20b (patch) | |
tree | 598108c244e671a55ece5ba77e0ea8c0945fe262 /install/tools/ipa-ldap-updater | |
parent | c67b47f9f693d0209572b34a6cf7927dcbf22200 (diff) | |
download | freeipa-b29de6bf27a51904adfdfb6cf918903f80e4c20b.tar.gz freeipa-b29de6bf27a51904adfdfb6cf918903f80e4c20b.tar.xz freeipa-b29de6bf27a51904adfdfb6cf918903f80e4c20b.zip |
Add LDAP upgrade over ldapi support.
This disables all but the ldapi listener in DS so it will be quiet when
we perform our upgrades. It is expected that any other clients that
also use ldapi will be shut down by other already (krb5 and dns).
Add ldapi as an option in ipaldap and add the beginning of pure offline
support (e.g. direct editing of LDIF files).
Diffstat (limited to 'install/tools/ipa-ldap-updater')
-rwxr-xr-x | install/tools/ipa-ldap-updater | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/install/tools/ipa-ldap-updater b/install/tools/ipa-ldap-updater index 746cd421..f3b83ce0 100755 --- a/install/tools/ipa-ldap-updater +++ b/install/tools/ipa-ldap-updater @@ -26,16 +26,12 @@ import sys try: from optparse import OptionParser - from ipapython import entity, ipautil, config + from ipapython import ipautil, config from ipaserver.install import installutils from ipaserver.install.ldapupdate import LDAPUpdate, BadSyntax, UPDATES_DIR + from ipaserver.install.upgradeinstance import IPAUpgrade import logging - import re import krbV - import platform - import shlex - import time - import random except ImportError: print >> sys.stderr, """\ There was a problem importing one of the required Python modules. The @@ -56,6 +52,10 @@ def parse_options(): help="Run through the update without changing anything") parser.add_option("-y", dest="password", help="File containing the Directory Manager password") + parser.add_option("-l", '--ldapi', action="store_true", dest="ldapi", + default=False, help="Connect to the LDAP server using the ldapi socket") + parser.add_option("-u", '--upgrade', action="store_true", dest="upgrade", + default=False, help="Upgrade an installed server in offline mode") config.add_standard_options(parser) options, args = parser.parse_args() @@ -79,25 +79,33 @@ def main(): if options.debug: loglevel = logging.DEBUG - logging.basicConfig(level=loglevel, - format='%(levelname)s %(message)s') - dirman_password = "" if options.password: pw = ipautil.template_file(options.password, []) dirman_password = pw.strip() else: - dirman_password = get_dirman_password() - - ld = LDAPUpdate(dm_password=dirman_password, sub_dict={}, live_run=not options.test) + if not options.ldapi and not options.upgrade: + dirman_password = get_dirman_password() - files=[] - if len(args) < 1: - files = ld.get_all_files(UPDATES_DIR) - else: + files = [] + if len(args) > 0: files = args - modified = ld.update(files) + if options.upgrade: + logging.basicConfig(level=loglevel, + format='%(levelname)s %(message)s', + filename='/var/log/ipaupgrade.log') + realm = krbV.default_context().default_realm + upgrade = IPAUpgrade(realm, files, live_run=not options.test) + upgrade.create_instance() + modified = upgrade.modified + else: + logging.basicConfig(level=loglevel, + format='%(levelname)s %(message)s') + ld = LDAPUpdate(dm_password=dirman_password, sub_dict={}, live_run=not options.test, ldapi=options.ldapi) + if len(files) < 1: + files = ld.get_all_files(UPDATES_DIR) + modified = ld.update(files) if modified and options.test: return 2 |