Fixes RequestContext initialization failure.
RequestContext initialization failed in nova because of the following error: "TypeError: 'in <string>' requires string as left operand, not NoneType" It must traverses in tuple not in string when find the "volume" service_catalog. Change-Id: Ie0de50fcafbeabf4698696add610d4e6804f45eb Closes-Bug: #1248424
This commit is contained in:
@@ -82,7 +82,7 @@ class RequestContext(object):
|
||||
if service_catalog:
|
||||
# Only include required parts of service_catalog
|
||||
self.service_catalog = [s for s in service_catalog
|
||||
if s.get('type') in ('volume')]
|
||||
if s.get('type') in ('volume',)]
|
||||
else:
|
||||
# if list is empty or none
|
||||
self.service_catalog = []
|
||||
|
@@ -95,7 +95,9 @@ class ContextTestCase(test.NoDBTestCase):
|
||||
{u'type': u'volume', u'name': u'cinder'},
|
||||
{u'type': u'ec2', u'name': u'ec2'},
|
||||
{u'type': u'object-store', u'name': u'swift'},
|
||||
{u'type': u'identity', u'name': u'keystone'}]
|
||||
{u'type': u'identity', u'name': u'keystone'},
|
||||
{u'type': None, u'name': u'S_withouttype'},
|
||||
{u'type': u'vo', u'name': u'S_partofvolume'}]
|
||||
|
||||
volume_catalog = [{u'type': u'volume', u'name': u'cinder'}]
|
||||
ctxt = context.RequestContext('111', '222',
|
||||
|
Reference in New Issue
Block a user