summaryrefslogtreecommitdiffstats
path: root/ipaclient
diff options
context:
space:
mode:
authorArmando Neto <abiagion@redhat.com>2018-07-03 11:00:57 -0300
committerChristian Heimes <cheimes@redhat.com>2018-07-05 19:42:43 +0200
commit53c549664795f54dbc337e45aeba84fbff843109 (patch)
tree9c7c2a01f8e4ea36ebffc217a9dcae1715c15aa8 /ipaclient
parent417f74868276cf67580d39d82f5bbfe96c83d62c (diff)
downloadfreeipa-53c549664795f54dbc337e45aeba84fbff843109.tar.gz
freeipa-53c549664795f54dbc337e45aeba84fbff843109.tar.xz
freeipa-53c549664795f54dbc337e45aeba84fbff843109.zip
ipa-client-install: Update how comments are added by ipachangeconf
Due to how 'openldap-client' parses its configuration files this patch changes how comments are added, moving them to the line above instead of appending to the same line. IPA doesn't want to break existing configuration, if a value already exists it adds a comment to the modified setting and a note about that on the line above. New settings will be added without any note. Issue: https://pagure.io/freeipa/issue/5202 Signed-off-by: Armando Neto <abiagion@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Diffstat (limited to 'ipaclient')
-rw-r--r--ipaclient/install/client.py7
-rw-r--r--ipaclient/install/ipachangeconf.py8
2 files changed, 11 insertions, 4 deletions
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 4b9c9d29f..b96feb47c 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -560,13 +560,14 @@ def configure_openldap_conf(fstore, cli_basedn, cli_server):
{
'name': 'comment',
'type': 'comment',
- 'value': ' In case any of them were set, a comment with '
- 'trailing note'
+ 'value': ' In case any of them were set, a comment has been '
+ 'inserted and'
},
{
'name': 'comment',
'type': 'comment',
- 'value': ' "# modified by IPA" note has been inserted.'
+ 'value': ' "# CONF_NAME modified by IPA" added to the line '
+ 'above.'
},
{
'name': 'comment',
diff --git a/ipaclient/install/ipachangeconf.py b/ipaclient/install/ipachangeconf.py
index 762661981..7e357cf6a 100644
--- a/ipaclient/install/ipachangeconf.py
+++ b/ipaclient/install/ipachangeconf.py
@@ -349,11 +349,17 @@ class IPAChangeConf(object):
opts.append(no)
continue
if no['action'] == 'addifnotset':
+ opts.append({
+ 'name': 'comment',
+ 'type': 'comment',
+ 'value': self._dump_line(
+ ' ', no['name'], ' modified by IPA'
+ ),
+ })
opts.append({'name': 'comment', 'type': 'comment',
'value': self._dump_line(no['name'],
self.dassign,
no['value'],
- u' # modified by IPA'
)})
opts.append(o)
continue