mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-27 09:21:59 -06:00
replica promotion: modify default.conf even if DS configuration fails
When we promote an IPA client to replica, we need to write master-like default.conf once we start configuring directory server instance. This way even if DS configuration fails for some reason the server uninstall code can work properly and clean up partially configured replica. https://fedorahosted.org/freeipa/ticket/5417 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
parent
b6c893aae6
commit
7978c21473
@ -1001,34 +1001,39 @@ def promote(installer):
|
|||||||
ntp = ntpinstance.NTPInstance()
|
ntp = ntpinstance.NTPInstance()
|
||||||
ntp.create_instance()
|
ntp.create_instance()
|
||||||
|
|
||||||
# Configure dirsrv
|
try:
|
||||||
ds = install_replica_ds(config, options, promote=True)
|
# Configure dirsrv
|
||||||
|
ds = install_replica_ds(config, options, promote=True)
|
||||||
|
|
||||||
# Always try to install DNS records
|
# Always try to install DNS records
|
||||||
install_dns_records(config, options, api)
|
install_dns_records(config, options, api)
|
||||||
|
|
||||||
# Must install http certs before changing ipa configuration file
|
# Must install http certs before changing ipa configuration file
|
||||||
# or certmonger will fail to contact the peer master
|
# or certmonger will fail to contact the peer master
|
||||||
install_http_certs(config, fstore)
|
install_http_certs(config, fstore)
|
||||||
|
|
||||||
ldapi_uri = installutils.realm_to_ldapi_uri(config.realm_name)
|
finally:
|
||||||
|
# Create the management framework config file
|
||||||
|
# do this regardless of the state of DS installation. Even if it fails,
|
||||||
|
# we need to have master-like configuration in order to perform a
|
||||||
|
# successful uninstallation
|
||||||
|
ldapi_uri = installutils.realm_to_ldapi_uri(config.realm_name)
|
||||||
|
|
||||||
# Create the management framework config file
|
gopts = [
|
||||||
gopts = [
|
ipaconf.setOption('host', config.host_name),
|
||||||
ipaconf.setOption('host', config.host_name),
|
ipaconf.rmOption('server'),
|
||||||
ipaconf.rmOption('server'),
|
ipaconf.setOption('xmlrpc_uri',
|
||||||
ipaconf.setOption('xmlrpc_uri',
|
'https://%s/ipa/xml' %
|
||||||
'https://%s/ipa/xml' %
|
ipautil.format_netloc(config.host_name)),
|
||||||
ipautil.format_netloc(config.host_name)),
|
ipaconf.setOption('ldap_uri', ldapi_uri),
|
||||||
ipaconf.setOption('ldap_uri', ldapi_uri),
|
ipaconf.setOption('mode', 'production'),
|
||||||
ipaconf.setOption('mode', 'production'),
|
ipaconf.setOption('enable_ra', 'True'),
|
||||||
ipaconf.setOption('enable_ra', 'True'),
|
ipaconf.setOption('ra_plugin', 'dogtag'),
|
||||||
ipaconf.setOption('ra_plugin', 'dogtag'),
|
ipaconf.setOption('dogtag_version', '10')]
|
||||||
ipaconf.setOption('dogtag_version', '10')]
|
opts = [ipaconf.setSection('global', gopts)]
|
||||||
opts = [ipaconf.setSection('global', gopts)]
|
|
||||||
|
|
||||||
ipaconf.changeConf(target_fname, opts)
|
ipaconf.changeConf(target_fname, opts)
|
||||||
os.chmod(target_fname, 0o644) # must be readable for httpd
|
os.chmod(target_fname, 0o644) # must be readable for httpd
|
||||||
|
|
||||||
custodia = custodiainstance.CustodiaInstance(config.host_name,
|
custodia = custodiainstance.CustodiaInstance(config.host_name,
|
||||||
config.realm_name)
|
config.realm_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user