Fixed exception handling
* It need for handling exception in case when exception catched.
It is wrong return empty dictionary if exception catched.
Change-Id: I76d71cae5ada0384cbc44c8d4e6cc537c04f8f96
Related-PROD: PROD-29484
diff --git a/_modules/keystonev3/common.py b/_modules/keystonev3/common.py
index 9a7744b..6fdbf18 100644
--- a/_modules/keystonev3/common.py
+++ b/_modules/keystonev3/common.py
@@ -111,12 +111,14 @@
kwargs.pop(k)
url, json = func(*args, **kwargs)
response = None
+ last_exception = None
for i in range(connect_retries):
try:
response = getattr(adapter, method)(
url, connect_retries=connect_retries,
json=json)
except Exception as e:
+ last_exception = e
if not hasattr(e, 'http_status') or (e.http_status >= 500
or e.http_status == 0):
msg = ("Got retriable exception when contacting "
@@ -125,7 +127,13 @@
log.error(msg % (connect_retry_delay, i, connect_retries))
time.sleep(connect_retry_delay)
continue
- break
+ else:
+ break
+ else:
+ last_exception = None
+ break
+ if last_exception:
+ raise KeystoneException(last_exception.message)
if not response or not response.content:
return {}
try: