Merge "Fix compatability with new oslo.messaging"

This commit is contained in:
Zuul 2023-09-20 01:09:47 +00:00 committed by Gerrit Code Review
commit b72beecca2
2 changed files with 11 additions and 1 deletions

View File

@ -117,7 +117,12 @@ class RequestContext(context.RequestContext):
LOG.debug('Arguments dropped when creating context: %s',
str(kwargs))
self.read_deleted = read_deleted
if read_deleted is None:
# If we did not get a value for read_deleted, ensure we default
# it to "no" as code expects it to be a string.
self.read_deleted = 'no'
else:
self.read_deleted = read_deleted
self.remote_address = remote_address
if not timestamp:
timestamp = timeutils.utcnow()

View File

@ -57,6 +57,11 @@ class ContextTestCase(test.NoDBTestCase):
ctxt.read_deleted = 'no'
self.assertEqual('no', ctxt.read_deleted)
def test_request_context_read_deleted_none(self):
ctxt = context.RequestContext('111',
'222')
self.assertEqual('no', ctxt.read_deleted)
def test_request_context_read_deleted_invalid(self):
self.assertRaises(ValueError,
context.RequestContext,