Hi, Makes sure that any new sources added are not already present in the entry.
https://fedorahosted.org/freeipa/ticket/4508 -- Tomas Babej Associate Software Engineer | Red Hat | Identity Management RHCE | Brno Site | IRC: tbabej | freeipa.org
>From 6cd6f5d523e11a70cd51788dd669cbd2e628eab6 Mon Sep 17 00:00:00 2001 From: Tomas Babej <tba...@redhat.com> Date: Wed, 27 Aug 2014 09:10:59 +0200 Subject: [PATCH] ipa-client-install: Do not add already configured sources to nsswitch.conf entries Makes sure that any new sources added are not already present in the entry. https://fedorahosted.org/freeipa/ticket/4508 --- ipa-client/ipa-install/ipa-client-install | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index 08fefc86d31392e9abf66ee4f8fff54a88179795..de466db526e5177b7906038cdb43ed4acef1da7c 100755 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -430,14 +430,20 @@ def configure_nsswitch_database(fstore, database, services, preserve=True, opts = conf.parse(f) raw_database_entry = conf.findOpts(opts, 'option', database)[1] - if not raw_database_entry: - # If there is no database entry, database is not present in - # the nsswitch.conf. Set the list of services to the - # default list, if passed. - configured_services = ' '.join(default_value or []) - else: - configured_services = raw_database_entry['value'].strip() + # Detect the list of already configured services + if not raw_database_entry: + # If there is no database entry, database is not present in + # the nsswitch.conf. Set the list of services to the + # default list, if passed. + configured_services = ' '.join(default_value or []) + else: + configured_services = raw_database_entry['value'].strip() + # Make sure no service is added if already mentioned in the list + services = [s for s in services + if s not in configured_services.split()] + + # Prepend / append the list of new services if append: new_services = ' ' + configured_services + ' ' + ' '.join(services) else: @@ -451,7 +457,7 @@ def configure_nsswitch_database(fstore, database, services, preserve=True, opts = [{'name': database, 'type':'option', 'action':'set', - 'value': new_services + 'value': new_services.strip() }, {'name':'empty', 'type':'empty' -- 1.9.3
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel