diff options
| author | Mikhail Nikolaenko <mnikolaenko@mirantis.com> | 2016-07-07 19:30:59 +0300 |
|---|---|---|
| committer | Mikhail Nikolaenko <mnikolaenko@mirantis.com> | 2016-08-05 15:21:17 +0300 |
| commit | b405d71a5f9562414ce6b08f7eb4556f534dd273 (patch) | |
| tree | a726d1520926d6a56f237972a024f0f7a2798b36 /keystoneclient/httpclient.py | |
| parent | 5a7f800e271695f21809d6251e91f6ac8e13ce23 (diff) | |
| download | python-keystoneclient-b405d71a5f9562414ce6b08f7eb4556f534dd273.tar.gz | |
Fix missing service_catalog parameter in Client object
Return None if service_catalog parameter does not exist.
service_catalog is the property and it is not initialized on object creation.
service_catalog tries to get value from auth_ref and raises AttributeError
exception if auth_ref is not initialized. It worked before we introduced
sessions, because authentication happened on client instantiation. Now,
when sessions are used, auth_ref is not initialized until the first
request. This change adds try-catch block in service_catalog property
to catch this error.
Change-Id: I58eb888f0989241f9e5626564bd48d901b324d36
Closes-Bug: #1508374
Diffstat (limited to 'keystoneclient/httpclient.py')
| -rw-r--r-- | keystoneclient/httpclient.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py index e7c2f24..98e958f 100644 --- a/keystoneclient/httpclient.py +++ b/keystoneclient/httpclient.py @@ -442,7 +442,10 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin): @property def service_catalog(self): """Return this client's service catalog.""" - return self.auth_ref.service_catalog + try: + return self.auth_ref.service_catalog + except AttributeError: + return None def has_service_catalog(self): """Return True if this client provides a service catalog.""" |
