new class BackendConfig to manage backend configs

This commit is contained in:
Romain Bignon 2011-05-21 10:26:57 +02:00
commit cb1372b99f
23 changed files with 234 additions and 171 deletions

View file

@ -73,6 +73,14 @@ class BackendsConfig(object):
continue
yield instance_name, backend_name, params
def backend_exists(self, name):
"""
Return True if the backend exists in config.
"""
config = RawConfigParser()
config.read(self.confpath)
return name in config.sections()
def add_backend(self, instance_name, backend_name, params, edit=False):
if not instance_name:
raise ValueError(u'Please give a name to the configured backend.')