On Tue, 2014-05-06 at 11:38 -0400, Nathaniel McCallum wrote: > On Tue, 2014-05-06 at 17:34 +0200, Petr Vobornik wrote: > > On 6.5.2014 17:13, Nathaniel McCallum wrote: > > > On Tue, 2014-05-06 at 17:04 +0200, Petr Vobornik wrote: > > >> On 6.5.2014 16:51, Nathaniel McCallum wrote: > > >>> Specifying the default in the LDAP Object causes the parameter to be > > >>> specified for non-add operations. This is especially problematic when > > >>> performing the modify operation as it causes the primary key to change > > >>> for every modification. > > >>> > > >>> https://fedorahosted.org/freeipa/ticket/4227 > > >>> > > >> > > >> shouldn't removal of `autofill=True,` be enough? > > > > > > Removing autofill=True results in the default not being used for the > > > otptoken-add operation. That may be a different bug (I'm not sure what > > > the expectation of autofill is). > > > > > > Nathaniel > > > > > > > Seems to work form me with: > > > > diff --git a/ipalib/plugins/otptoken.py b/ipalib/plugins/otptoken.py > > index f68ea7d..623f1f1 100644 > > --- a/ipalib/plugins/otptoken.py > > +++ b/ipalib/plugins/otptoken.py > > @@ -121,9 +121,7 @@ class otptoken(LDAPObject): > > cli_name='id', > > label=_('Unique ID'), > > default_from=lambda: unicode(uuid.uuid4()), > > - autofill=True, > > primary_key=True, > > - flags=('optional_create'), > > ), > > StrEnum('type?', > > label=_('Type'), > > Doing this causes the ipa otptoken-add command to prompt for the Unique > ID. This may be the desired behavior, but it is not how it worked > previously (no prompt).
Here is an alternate patch for this second approach. I have no strong opinion on the correct behavior here. Nathaniel
>From 00a5e223c3809f409f93020e29654321b318ba0f Mon Sep 17 00:00:00 2001 From: Nathaniel McCallum <npmccal...@redhat.com> Date: Thu, 1 May 2014 16:31:45 -0400 Subject: [PATCH] Only use the ipatokenuniqueid default in the add operation Without this patch, the ipatokenuniqueid attribute gets filled in during non-add operations. This is especially problematic when performing the modify operation as it causes the primary key to change for every modification. https://fedorahosted.org/freeipa/ticket/4227 --- ipalib/plugins/otptoken.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ipalib/plugins/otptoken.py b/ipalib/plugins/otptoken.py index f68ea7df596c8d7e837d98874f4fd630a6d7524a..623f1f1dcd798aa7b8f3b9210b2de90fb82cd4bf 100644 --- a/ipalib/plugins/otptoken.py +++ b/ipalib/plugins/otptoken.py @@ -121,9 +121,7 @@ class otptoken(LDAPObject): cli_name='id', label=_('Unique ID'), default_from=lambda: unicode(uuid.uuid4()), - autofill=True, primary_key=True, - flags=('optional_create'), ), StrEnum('type?', label=_('Type'), -- 1.9.0
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel