diff options
| author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-03-18 15:28:57 -0400 |
|---|---|---|
| committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-03-18 18:06:52 -0400 |
| commit | 4664d2294aed498ef013afc1689740f03de80a6c (patch) | |
| tree | 190346ebe622de6a6a933d3c8303d8cbb95b2051 /nova/tests | |
| parent | 85aebeb8b864f990cdfb78b6deafc8a3fe3c1e23 (diff) | |
Fix RequestContext crashes w/ no service catalog
Code introduced in a prev review assumed service_catalog will be
at least an empty list and will never be None. But missed one code
path where the service_catalog could potentially be set to None. So
this change switches back the default value of service_catalog in
the arguments to None and makes sure we tolerate anyone else
passing in a None or Empty list as service_catalog
Fix for LP# 1156730
Change-Id: I480b761d57c4699ea7ef72114160cdbeb281e454
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_context.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nova/tests/test_context.py b/nova/tests/test_context.py index 99b5c705c..4639f75b0 100644 --- a/nova/tests/test_context.py +++ b/nova/tests/test_context.py @@ -79,6 +79,14 @@ class ContextTestCase(test.TestCase): ctxt = context.RequestContext('111', '222') self.assertEquals(ctxt.service_catalog, []) + ctxt = context.RequestContext('111', '222', + service_catalog=[]) + self.assertEquals(ctxt.service_catalog, []) + + ctxt = context.RequestContext('111', '222', + service_catalog=None) + self.assertEquals(ctxt.service_catalog, []) + def test_service_catalog_cinder_only(self): service_catalog = [ {u'type': u'compute', u'name': u'nova'}, |
