Only initialize the API once in the installer

Make the ldap2 plugin schema loader ignore SERVER_DOWN errors

525303
This commit is contained in:
Rob Crittenden
2009-09-28 23:34:15 -04:00
committed by Jason Gerard DeRose
parent 38a27b1c2f
commit e4877c946f
4 changed files with 36 additions and 35 deletions

View File

@@ -32,7 +32,6 @@ from ipaserver.install import bindinstance, httpinstance, ntpinstance, certs
from ipaserver import ipaldap
from ipapython import version
from ipalib import api, util
from ipalib.constants import DEFAULT_CONFIG
CACERT="/usr/share/ipa/html/ca.crt"
@@ -134,14 +133,6 @@ def install_ca(config):
# FIXME, need to pass along the CA plugin to use
cafile = config.dir + "/ca.p12"
# Just initialize the environment. This is so the installer can have
# access to the plugin environment
api.env._bootstrap()
default_config = dict(DEFAULT_CONFIG)
if ipautil.file_exists(cafile):
default_config['ra_plugin'] = 'dogtag'
api.env._finalize_core(**default_config)
if not ipautil.file_exists(cafile):
return None
@@ -320,6 +311,14 @@ def main():
except ldap.INVALID_CREDENTIALS, e :
sys.exit("\nThe password provided is incorrect for LDAP server %s" % config.master_host_name)
if ipautil.file_exists(config.dir + "/ca.p12"):
ca_type = 'dogtag'
else:
ca_type = 'selfsign'
api.bootstrap(in_server=True, ra_plugin=ca_type)
api.finalize()
# Install CA cert so that we can do SSL connections with ldap
install_ca_cert(config)
@@ -379,9 +378,6 @@ def main():
service.restart("krb5kdc")
if options.setup_dns:
# First bootstrap the plug-in framework
api.bootstrap(in_server=True)
api.finalize()
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager",
bind_pw=config.dirman_password)

View File

@@ -52,7 +52,6 @@ from ipaserver.install.installutils import *
from ipapython import sysrestore
from ipapython.ipautil import *
from ipalib import api, util
from ipalib.constants import DEFAULT_CONFIG
pw_name = None
@@ -402,14 +401,6 @@ def main():
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGINT, signal_handler)
# Just initialize the environment. This is so the installer can have
# access to the plugin environment
api.env._bootstrap()
default_config = dict(DEFAULT_CONFIG)
if options.ca:
default_config['ra_plugin'] = 'dogtag'
api.env._finalize_core(**default_config)
if options.uninstall:
standard_logging_setup("/var/log/ipaserver-uninstall.log", options.debug)
else:
@@ -419,6 +410,14 @@ def main():
global fstore
fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore')
if options.ca:
ca_type = 'dogtag'
else:
ca_type = 'selfsign'
api.bootstrap(in_server=True, ra_plugin=ca_type)
api.finalize()
if options.uninstall:
if not options.unattended:
print "\nThis is a NON REVERSIBLE operation and will delete all data and configuration!\n"
@@ -712,9 +711,6 @@ def main():
bind = bindinstance.BindInstance(fstore, dm_password)
bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders)
if options.setup_dns:
# First bootstrap the plug-in framework
api.bootstrap(in_server=True)
api.finalize()
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password)
bind.create_instance()