[Freeipa-devel] [PATCH] 54 Fix attempted write to attribute of read-only object

Jan Cholasta jcholast at redhat.com
Wed Dec 21 13:32:44 UTC 2011


Dne 2.12.2011 21:26, Alexander Bokovoy napsal(a):
> On Fri, 02 Dec 2011, Jan Cholasta wrote:
>>>> I don't like the idea of introducing a new class every time we need a
>>>> ReadOnly attribute to be writable. There's quite a few places in the
>>>> code where we do object.__setattr__ on ReadOnly objects. IMO the right
>>>> thing to do would be to add means of whitelisting ReadOnly attributes
>>>> that need to stay writable after locking.
>>>>
>>>>>
>>>>> You can move those _select_ca(), _select_any_master(),
>>>>> _host_has_service() to CaCache as they seem to not depend on anything
>>>>> in class ca but rather use global api.env.
>>>>>
>>>>> This way you will get is a fairly simple CaCache class reusable both
>>>>> in ca and ra classes.
>>>>
>>>> Honza
>>>>
>>>
>>> What is the status of this patch?
>>>
>>> rob
>>
>> It fixes the issue and I wouldn't mind leaving it as it is.
>>
>> Alexander?
>
> I still don't like it. There is nothing in CA that really requires
> enabling writting to ReadOnly after locking. ReadOnly is a fundamental
> promise of our API and breaking it should be possible only for cases
> where any other approach will be ineffective. This particular case is
> rather poor implementation of CA/RA classes that could be solved in a
> simpler way.
>
> Sometimes you need to hold promises. ;)
>

Updated and rebased the patch.

Added a class for creating property-like attributes that cache the 
return value of a function call.

Fixed some more unit test issues that popped up since I first made the 
patch.

Note that some tests are still failing, most of the failures seem to be 
related to user private groups (see attached log).

Honza

-- 
Jan Cholasta
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-jcholast-54.2-fix-read-only-write.patch
Type: text/x-patch
Size: 9201 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111221/5e51d6de/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.log
Type: text/x-log
Size: 110204 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111221/5e51d6de/attachment-0001.bin>


More information about the Freeipa-devel mailing list