[Freeipa-devel] [PATCH] 0139 trustdomain_find: make sure we skip short entries when --pkey-only is specified
Martin Kosek
mkosek at redhat.com
Thu Feb 27 11:33:34 UTC 2014
On 02/27/2014 11:06 AM, Alexander Bokovoy wrote:
> On Thu, 27 Feb 2014, Martin Kosek wrote:
>> On 02/26/2014 05:03 PM, Alexander Bokovoy wrote:
>>> On Wed, 26 Feb 2014, Martin Kosek wrote:
>>>> On 02/25/2014 06:56 PM, Alexander Bokovoy wrote:
>>>>> Hi,
>>>>>
>>>>> Simple patch to fix KeyError as --pkey-only causes no attributes to be
>>>>> returned and trustdomain_find.post_callback checked them
>>>>> unconditionally.
>>>>>
>>>>>
>>>>> https://fedorahosted.org/freeipa/ticket/4196
>>>>
>>>> Can we simply skip the whole loop when options.get('pkey_only', False)? I.e.:
>>>>
>>>> def post_callback(self, ldap, entries, truncated, *args, **options):
>>>> if not options.get('pkey_only', False):
>>>> trust_dn = self.obj.get_dn(args[0], trust_type=u'ad')
>>>> trust_entry = ldap.get_entry(trust_dn)
>>>> ...
>>>>
>>>> It seems to me that your way we still do one unnecessary LDAP search which is
>>>> never used. With pkey_only we should not be filling anything in post_callback
>>>> at all if it is not affecting the pkey.
>>> Right, new patch attached.
>>>
>>
>> It still crashes:
>>
>> [Thu Feb 27 04:55:51.245147 2014] [:error] [pid 3479] Traceback (most recent
>> call last):
>> [Thu Feb 27 04:55:51.245149 2014] [:error] [pid 3479] File
>> "/usr/lib/python2.7/site-packages/ ipaserver/rpcserver.py", line 333,
>> in wsgi_execute
>> [Thu Feb 27 04:55:51.245152 2014] [:error] [pid 3479] result =
>> self.Command[name](*args, **options)
>> [Thu Feb 27 04:55:51.245155 2014] [:error] [pid 3479] File
>> "/usr/lib/python2.7/site-packages/ipalib/ frontend.py", line 447, in __call__
>> [Thu Feb 27 04:55:51.245157 2014] [:error] [pid 3479]
>> self.validate_output(ret)
>> [Thu Feb 27 04:55:51.245159 2014] [:error] [pid 3479] File
>> "/usr/lib/python2.7/site-packages/ipalib/ frontend.py", line 947, in
>> validate_output
>> [Thu Feb 27 04:55:51.245162 2014] [:error] [pid 3479] nice, o.name, o.type,
>> type(value), value)
>> [Thu Feb 27 04:55:51.245164 2014] [:error] [pid 3479] TypeError:
>> trustdomain_find.validate_output():
>> [Thu Feb 27 04:55:51.245167 2014] [:error] [pid 3479] output['truncated']:
>> need <type 'bool'>; got
>>
>>
>> You need to "return truncated", not just "return". When this is changed, patch
>> works as expected.
> Yep, thanks!
>
> New patch attached.
>
ACK. Pushed to master, ipa-3-3.
Martin
More information about the Freeipa-devel
mailing list