summaryrefslogtreecommitdiffstats
path: root/server/config
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-12-07 14:50:48 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-08 23:35:24 -0500
commit52c30653a625b4b06e7cbdd319372f8018a1a376 (patch)
tree03afcf171645df2739522f31c2259b711df4bc77 /server/config
parentfa9f50878bc93b4ebe5ebf012b207494ff29e6fc (diff)
downloadsssd-52c30653a625b4b06e7cbdd319372f8018a1a376.tar.gz
sssd-52c30653a625b4b06e7cbdd319372f8018a1a376.tar.xz
sssd-52c30653a625b4b06e7cbdd319372f8018a1a376.zip
SSSDDomain.remove_provider() requires only the provider type
There was no valid reason to require the backend type when specifying a provider to remove.
Diffstat (limited to 'server/config')
-rw-r--r--server/config/SSSDConfig.py18
-rw-r--r--server/config/SSSDConfigTest.py12
2 files changed, 18 insertions, 12 deletions
diff --git a/server/config/SSSDConfig.py b/server/config/SSSDConfig.py
index 1cbf1a84d..1992a9404 100644
--- a/server/config/SSSDConfig.py
+++ b/server/config/SSSDConfig.py
@@ -787,14 +787,12 @@ class SSSDDomain(SSSDConfigObject):
provider_type)))
- def remove_provider(self, provider, provider_type):
+ def remove_provider(self, provider_type):
"""
Remove a provider from the domain. If the provider is not present, it
is ignored.
- type:
- Provider backend type. (e.g. local, ldap, krb5, etc.)
- subtype:
+ provider_type:
Subtype of the backend type. (e.g. id, auth, chpass)
=== Returns ===
@@ -803,7 +801,15 @@ class SSSDDomain(SSSDConfigObject):
=== Errors ===
No Errors
"""
- if (provider,provider_type) not in self.providers:
+
+ provider = None
+ for (provider, ptype) in self.providers:
+ if ptype == provider_type:
+ break
+ provider = None
+
+ # Check whether the provider_type was found
+ if not provider:
return
# TODO: safely remove any unused options when removing
@@ -811,7 +817,7 @@ class SSSDDomain(SSSDConfigObject):
# to account for multiple providers making use of the
# same options (such ask krb5_realm)
- self.providers.remove((provider,provider_type))
+ self.providers.remove((provider, provider_type))
class SSSDConfig(SSSDChangeConf):
"""
diff --git a/server/config/SSSDConfigTest.py b/server/config/SSSDConfigTest.py
index ac37aec9b..fa111819f 100644
--- a/server/config/SSSDConfigTest.py
+++ b/server/config/SSSDConfigTest.py
@@ -142,7 +142,7 @@ class SSSDConfigTestValid(unittest.TestCase):
ldap_domain = sssdconfig.get_domain('LDAP')
ldap_domain.set_option('debug_level', 3)
- ldap_domain.remove_provider('ldap', 'auth')
+ ldap_domain.remove_provider('auth')
ldap_domain.add_provider('krb5', 'auth')
ldap_domain.set_active(True)
sssdconfig.save_domain(ldap_domain)
@@ -455,7 +455,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
# Remove the auth domain and verify that the options
# revert to the backup_list
- domain.remove_provider('krb5', 'auth')
+ domain.remove_provider('auth')
options = domain.list_options()
self.assertTrue(type(options) == dict,
@@ -666,7 +666,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
# Remove the auth domain and verify that the options
# revert to the backup_list
- domain.remove_provider('krb5', 'auth')
+ domain.remove_provider('auth')
options = domain.list_options()
self.assertTrue(type(options) == dict,
@@ -685,15 +685,15 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
option)
# Test removing nonexistent provider - Real
- domain.remove_provider('ldap', 'id')
+ domain.remove_provider('id')
# Test removing nonexistent provider - Bad backend type
# Should pass without complaint
- domain.remove_provider('nosuchbackend', 'id')
+ domain.remove_provider('id')
# Test removing nonexistent provider - Bad provider type
# Should pass without complaint
- domain.remove_provider('ldap', 'nosuchprovider')
+ domain.remove_provider('nosuchprovider')
def testGetOption(self):
domain = SSSDConfig.SSSDDomain('sssd', self.schema)