diff options
author | Tomas Babej <tbabej@redhat.com> | 2013-04-22 12:55:38 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2013-04-30 10:54:10 -0400 |
commit | 5d6a9d3befb5434dd7b2d1bbafd76050f22743a2 (patch) | |
tree | cefb645910a7a8af15da1f8cb5f7850978afe10e /ipa-client/ipaclient | |
parent | 732d1042a35c7db64c4ce1980e938666c65671ea (diff) | |
download | freeipa-5d6a9d3befb5434dd7b2d1bbafd76050f22743a2.tar.gz freeipa-5d6a9d3befb5434dd7b2d1bbafd76050f22743a2.tar.xz freeipa-5d6a9d3befb5434dd7b2d1bbafd76050f22743a2.zip |
Preserve already configured options in openldap conf
We should respect already configured options present in
/etc/openldap/ldap.conf when generating our own configuration.
With this patch, we only rewrite URI, BASE and TLS_CACERT options
only if they are not configured. In the case they are, our suggested
configuration is inserted as a comment.
Also adds tab as a delimeter character in /etc/openldap/ldap.conf
https://fedorahosted.org/freeipa/ticket/3582
Diffstat (limited to 'ipa-client/ipaclient')
-rw-r--r-- | ipa-client/ipaclient/ipachangeconf.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ipa-client/ipaclient/ipachangeconf.py b/ipa-client/ipaclient/ipachangeconf.py index bdc5579fc..e802e177e 100644 --- a/ipa-client/ipaclient/ipachangeconf.py +++ b/ipa-client/ipaclient/ipachangeconf.py @@ -338,7 +338,16 @@ class IPAChangeConf: if no['action'] == 'set': opts.append(no) continue - raise SyntaxError('Unknown action: [%s]' % o['action']) + if no['action'] == 'addifnotset': + opts.append({'name': 'comment', 'type': 'comment', + 'value': self._dump_line(no['name'], + self.dassign, + no['value'], + u' # modified by IPA' + )}) + opts.append(o) + continue + raise SyntaxError('Unknown action: [%s]' % no['action']) raise SyntaxError('Unknown type: [%s]' % o['type']) @@ -365,7 +374,7 @@ class IPAChangeConf: if no['type'] == "option": (num, o) = self.findOpts(opts, no['type'], no['name'], True) if not o: - if no['action'] == 'set': + if no['action'] == 'set' or no['action'] == 'addifnotset': opts.append(no) continue cline = num + 1 @@ -385,6 +394,7 @@ class IPAChangeConf: # the options as indicated by the contents of newopts #Second we fill in the new opts tree with options as indicated # in the newopts tree (this is becaus eentire (sub)sections may + # in the newopts tree (this is becaus entire (sub)sections may # exist in the newopts that do not exist in oldopts) opts = self.mergeOld(oldopts, newopts) |