diff options
author | Simo Sorce <simo@redhat.com> | 2014-10-27 11:25:46 -0400 |
---|---|---|
committer | Patrick Uiterwijk <puiterwijk@redhat.com> | 2014-11-12 23:47:25 +0100 |
commit | b7b80c5c0fc1895e85aae3acbfcbbc593a42697f (patch) | |
tree | 530512524a374059a9648ace99c56146af95bf4d /ipsilon/info/nss.py | |
parent | c6b167fcf290c415b8d1903237fb5405b7213405 (diff) | |
download | ipsilon.git-b7b80c5c0fc1895e85aae3acbfcbbc593a42697f.tar.gz ipsilon.git-b7b80c5c0fc1895e85aae3acbfcbbc593a42697f.tar.xz ipsilon.git-b7b80c5c0fc1895e85aae3acbfcbbc593a42697f.zip |
Refactor plugin initialization and enablement
Move most plugin enablement and initialization code in plugin.py to
reduce code duplication and simplify and unifify plugin enablement
for all base plugin types (login, info, providers).
This patch breaks backwards compatibility as it changes how the list
of enabled plugins is stored in the database tables.
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/info/nss.py')
-rwxr-xr-x | ipsilon/info/nss.py | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/ipsilon/info/nss.py b/ipsilon/info/nss.py index 3dfd885..50c84a8 100755 --- a/ipsilon/info/nss.py +++ b/ipsilon/info/nss.py @@ -20,8 +20,8 @@ posix_map = { class InfoProvider(InfoProviderBase): - def __init__(self): - super(InfoProvider, self).__init__() + def __init__(self, *pargs): + super(InfoProvider, self).__init__(*pargs) self.mapper = InfoMapping() self.mapper.set_mapping(posix_map) self.name = 'nss' @@ -75,9 +75,10 @@ class InfoProvider(InfoProviderBase): class Installer(InfoProviderInstaller): - def __init__(self): + def __init__(self, *pargs): super(Installer, self).__init__() self.name = 'nss' + self.pargs = pargs def install_args(self, group): group.add_argument('--info-nss', choices=['yes', 'no'], default='no', @@ -88,18 +89,11 @@ class Installer(InfoProviderInstaller): return # Add configuration data to database - po = PluginObject() + po = PluginObject(*self.pargs) po.name = 'nss' po.wipe_data() - po.wipe_config_values(self.facility) + po.wipe_config_values() - # Replace global config, only one plugin info can be used - po.name = 'global' - globalconf = po.get_plugin_config(self.facility) - if 'order' in globalconf: - order = globalconf['order'].split(',') - else: - order = [] - order.append('nss') - globalconf['order'] = ','.join(order) - po.save_plugin_config(self.facility, globalconf) + # Update global config to add login plugin + po.is_enabled = True + po.save_enabled_state() |