From 41a7a8d3d4d79cf15dac5583fc5aa8c301282c98 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Mon, 30 Nov 2009 12:10:06 +0100 Subject: Add --enable-migration option in config plugin. --- ipalib/plugins/config.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py index 82eea97ba..3030ce7c7 100644 --- a/ipalib/plugins/config.py +++ b/ipalib/plugins/config.py @@ -22,7 +22,7 @@ IPA configuration """ from ipalib import api -from ipalib import Int, Str +from ipalib import Bool, Int, Str from ipalib.plugins.baseldap import * @@ -35,6 +35,7 @@ class config(LDAPObject): 'ipamaxusernamelength', 'ipahomesrootdir', 'ipadefaultloginshell', 'ipadefaultprimarygroup', 'ipadefaultdomain', 'ipasearchtimelimit', 'ipasearchrecordslimit', 'ipausersearchfields', 'ipagroupsearchfields', + 'ipamigrationenabled', ] attribute_names = { 'ipamaxusernamelength': 'maximum username length', @@ -46,6 +47,7 @@ class config(LDAPObject): 'ipasearchrecordslimit': 'result count limit for search queries', 'ipausersearchfields': 'search fields for users', 'ipagroupsearchfields': 'search fields for groups', + 'ipamigrationenabled': 'enable migration mode', } takes_params = ( @@ -88,6 +90,10 @@ class config(LDAPObject): cli_name='groupsearch', doc='A comma-separated list of fields to search when searching for groups', ), + Bool('ipamigrationenabled?', + cli_name='enable_migration', + doc='Enabled migration mode', + ), ) def get_dn(self, *keys, **kwargs): @@ -100,6 +106,13 @@ class config_mod(LDAPUpdate): """ Modify configuration options. """ + def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): + if 'ipamigrationenabled' in entry_attrs: + if entry_attrs['ipamigrationenabled']: + entry_attrs['ipamigrationenabled'] = 'TRUE' + else: + entry_attrs['ipamigrationenabled'] = 'FALSE' + return dn api.register(config_mod) -- cgit