Fix _get_rate_limit when resp is None

https://review.openstack.org/332848 added retry logic for the client.
Function _get_rate_limit may receive resp=None (seen in the Sahara
unit tests), and in that case we get an exception.

Change-Id: Ibfbb10087121bae7d6f4abdd4cdb8d04d039c970
This commit is contained in:
Javier Pena 2016-07-06 16:06:28 +02:00
parent f8eef18297
commit ebe02fb877

@ -160,7 +160,7 @@ class OverLimit(ClientException):
self._get_rate_limit(response)
def _get_rate_limit(self, resp):
if resp.headers:
if (resp is not None) and resp.headers:
utc_now = timeutils.utcnow()
value = resp.headers.get('Retry-After', '0')
try: