[openstack-dev] [oslo] UUID sentinel needs a home

Eric Fried openstack at fried.cc
Fri Aug 24 18:16:23 UTC 2018


So...

Restore the PS of the oslo_utils version that exposed the global [1]?

Or use the forced-singleton pattern from nova [2] to put it in its own
importable module, e.g. oslo_utils.uuidutils.uuidsentinel?

(FTR, "import only modules" is a thing for me too, but I've noticed it
doesn't seem to be a hard and fast rule in OpenStack; and in this case
it seemed most important to emulate the existing syntax+behavior for
consumers.)

-efried

[1] https://review.openstack.org/#/c/594179/2/oslo_utils/uuidutils.py
[2]
https://github.com/openstack/nova/blob/a421bd2a8c3b549c603df7860e6357738e79c7c3/nova/tests/uuidsentinel.py#L30

On 08/23/2018 11:23 PM, Doug Hellmann wrote:
> 
> 
>> On Aug 23, 2018, at 4:01 PM, Ben Nemec <openstack at nemebean.com> wrote:
>>
>>
>>
>>> On 08/23/2018 12:25 PM, Doug Hellmann wrote:
>>> Excerpts from Eric Fried's message of 2018-08-23 09:51:21 -0500:
>>>> Do you mean an actual fixture, that would be used like:
>>>>
>>>>  class MyTestCase(testtools.TestCase):
>>>>      def setUp(self):
>>>>          self.uuids = self.useFixture(oslofx.UUIDSentinelFixture()).uuids
>>>>
>>>>      def test_foo(self):
>>>>          do_a_thing_with(self.uuids.foo)
>>>>
>>>> ?
>>>>
>>>> That's... okay I guess, but the refactoring necessary to cut over to it
>>>> will now entail adding 'self.' to every reference. Is there any way
>>>> around that?
>>> That is what I had envisioned, yes.  In the absence of a global,
>>> which we do not want, what other API would you propose?
>>
>> If we put it in oslotest instead, would the global still be a problem? Especially since mock has already established a pattern for this functionality?
> 
> I guess all of the people who complained so loudly about the global in oslo.config are gone?
> 
> If we don’t care about the global then we could just put the code from Eric’s threadsafe version in oslo.utils somewhere. 
> 
> Doug
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 



More information about the OpenStack-dev mailing list