summaryrefslogtreecommitdiffstats
path: root/ipa-client
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2015-11-11 14:28:46 +0100
committerTomas Babej <tbabej@redhat.com>2015-11-26 12:18:08 +0100
commit8403bd9d15a7817a15b85d8e108cad1c155aadbc (patch)
tree07a3c800f7c54e0fbce93590146d2a14f9af4b64 /ipa-client
parent304c8694c4f945846ced5bf3cdaf18d899241876 (diff)
downloadfreeipa-8403bd9d15a7817a15b85d8e108cad1c155aadbc.tar.gz
freeipa-8403bd9d15a7817a15b85d8e108cad1c155aadbc.tar.xz
freeipa-8403bd9d15a7817a15b85d8e108cad1c155aadbc.zip
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>
Diffstat (limited to 'ipa-client')
-rwxr-xr-xipa-client/ipa-install/ipa-client-automount20
1 files changed, 15 insertions, 5 deletions
diff --git a/ipa-client/ipa-install/ipa-client-automount b/ipa-client/ipa-install/ipa-client-automount
index 54906e5b2..1d0428772 100755
--- a/ipa-client/ipa-install/ipa-client-automount
+++ b/ipa-client/ipa-install/ipa-client-automount
@@ -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)