mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-13 09:41:55 -06:00
ipa-client-automount: Leverage IPAChangeConf to configure the domain for idmapd
Simple regexp substitution caused that the domain directive fell under an inapprorpiate section, if the domain directive was not present. Hence the idmapd.conf file was not properly parsed. Use IPAChangeConf to put the directive in its correct place even if it the domain directive is missing. https://fedorahosted.org/freeipa/ticket/5069 Reviewed-By: Gabe Alford <redhatrises@gmail.com>
This commit is contained in:
parent
304c8694c4
commit
8403bd9d15
@ -318,11 +318,21 @@ def configure_nfs(fstore, statestore):
|
||||
|
||||
print("Configured %s" % paths.SYSCONFIG_NFS)
|
||||
|
||||
replacevars = {
|
||||
'Domain': api.env.domain,
|
||||
}
|
||||
ipautil.backup_config_and_replace_variables(fstore,
|
||||
paths.IDMAPD_CONF, replacevars=replacevars)
|
||||
# Prepare the changes
|
||||
# We need to use IPAChangeConf as simple regexp substitution
|
||||
# does not cut it here
|
||||
conf = ipachangeconf.IPAChangeConf("IPA automount installer")
|
||||
conf.case_insensitive_sections = False
|
||||
conf.setOptionAssignment(" = ")
|
||||
conf.setSectionNameDelimiters(("[", "]"))
|
||||
|
||||
changes = [conf.setOption('Domain', api.env.domain)]
|
||||
section_with_changes = [conf.setSection('General', changes)]
|
||||
|
||||
# Backup the file and apply the changes
|
||||
fstore.backup_file(paths.IDMAPD_CONF)
|
||||
conf.changeConf(paths.IDMAPD_CONF, section_with_changes)
|
||||
|
||||
tasks.restore_context(paths.IDMAPD_CONF)
|
||||
|
||||
print("Configured %s" % paths.IDMAPD_CONF)
|
||||
|
Loading…
Reference in New Issue
Block a user