glance/glance/quota
Chris Dent deffb09871 Make QuotaImageTagsProxy deep-copyable
Infinite recursion is possible if you try to deepcopy a
QuotaImageTagsProxy object, which is something that happens when using
oslo.policy 1.43.1 and beyond.

By adding a __gettattribute__ within the __getattr__ method we can break
the loop when the name of the attribute is 'tags'.

The added test will fail (with infinite recursion) if the new code is
removed.

For completeness a test is added checking what happens when the tags
attribute is removed.

The thing that is not immediately clear from the __getattr__ code is
that it is not for getting at the tags themselves, it is for getting
at the methods on the set object at self.tags. The non-obviousness
of this led to rather a lot of confusion while trying to get this
code right. It isn't really "right" now, but rather: safe in the
context of its use.

Change-Id: Ic47c9bf8e9b97de5a5a49a35f631753c54e0e2af
Related-Bug: #1808063
2018-12-18 21:16:19 +00:00
..
__init__.py Make QuotaImageTagsProxy deep-copyable 2018-12-18 21:16:19 +00:00