Prevent AttributeError if no authorization
If you ask client if there is a service catalog when it is unauthorized it tries to look up the service catalog on a None object. If the client is unauthorized it should always return False as there cannot be a service catalog. Change-Id: I439f71e548b8230e7ce38d1a0e9d0d8f9b205d77 Closes-Bug: 1239219
This commit is contained in:
@@ -312,7 +312,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
||||
|
||||
def has_service_catalog(self):
|
||||
"""Returns True if this client provides a service catalog."""
|
||||
return self.auth_ref.has_service_catalog()
|
||||
return self.auth_ref and self.auth_ref.has_service_catalog()
|
||||
|
||||
@property
|
||||
def tenant_id(self):
|
||||
|
||||
@@ -33,6 +33,7 @@ class KeystoneClientTest(utils.TestCase):
|
||||
self.assertFalse(c.auth_ref.project_scoped)
|
||||
self.assertEqual(c.auth_user_id,
|
||||
'c4da488862bd435c9e6c0275a0d0e49a')
|
||||
self.assertFalse(c.has_service_catalog())
|
||||
|
||||
def test_domain_scoped_init(self):
|
||||
self.stub_auth(json=client_fixtures.domain_scoped_token())
|
||||
|
||||
Reference in New Issue
Block a user