[Freeipa-devel] [PATCH 0001] Migrate now accepts scope as argument
Martin Basti
mbasti at redhat.com
Wed Jun 3 13:24:47 UTC 2015
On 02/06/15 22:32, Drew Erny wrote:
> Sorry, the email address on that patch is wrong. It picked the old one
> off my personal box when I migrated my dotfiles. I don't know if
> that's important, but if the merger could
> s/dperny at crimson.ua.edu/derny at redhat.com/g, that would be better.
> Sorry about that, I'll fix it in my next patch.
>
> On 06/02/2015 04:23 PM, Drew Erny wrote:
>> Hi, all,
>>
>> This is my first patch, which fixes Ticket #2547 at
>> https://fedorahosted.org/freeipa/ticket/2547
>>
>> It introduces a --scope option to "ipa migrate-ds" which allows the
>> user to specify the search depth of a migration. The previous default
>> behavior is the same as --scope=onelevel. To search nested OUs, the
>> user uses --scope=subtree. --scope=base will cause the migrate script
>> not to find anything, but has been included for completeness. Any
>> other option is invalid and will cause the command to abort.
>>
>> Please review this one carefully, because I'm only like 98% confident
>> it doesn't break anything. The only thing I'm not sure about is that
>> if you run ipa migrate-ds without --scope specified, it gives an
>> interactive input for that option; I'm not sure if it's supposed to
>> do that.
>>
>> Thanks,
>>
>> Drew Erny
>> derny at redhat.com
>>
>>
>
>
>
Hello,
thank you for your patch.
1)
Please don't use backslash
+ doc=_('LDAP search scope for users and groups: base,
onelevel, or '\
+ 'subtree. Defaults to onelevel'),
2)
You can use dictionary:
_default_scope = 'onelevel' # I do not like hardcoded index there
_supported_scopes = {'base': ldap.SCOPE_BASE, _default_scope:
ldap.SCOPE_ONELEVEL, ...}
StrEnum(
....
values=_supported_scopes.keys(),
default=_default_scope
)
scope = _supported_scopes[options.get('scope', _default_scope)] # or
autofill=True should be in StrEnum param for scope instead, I'm not
sure, you must test it :-)
3) do not forget to change the email
PS: I did not test the code, it is just example.
Martin^2
--
Martin Basti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20150603/e3a65474/attachment.htm>
More information about the Freeipa-devel
mailing list