Merge "Fix cinderv3 rerty"
diff --git a/_modules/cinderv3/arg_converter.py b/_modules/cinderv3/arg_converter.py
index 3506c6d..3a57f8b 100644
--- a/_modules/cinderv3/arg_converter.py
+++ b/_modules/cinderv3/arg_converter.py
@@ -14,11 +14,7 @@
def named_checker(resource, ref, cloud_name):
resp_key = response_keys[resource]
resp = resource_lists[resource](
- name=ref, cloud_name=cloud_name)
- try:
- resp = resp[resp_key]
- except KeyError:
- raise common.ResourceNotFound(resp_key, ref)
+ name=ref, cloud_name=cloud_name)[resp_key]
if len(resp) == 0:
raise common.ResourceNotFound(resp_key, ref)
elif len(resp) > 1:
@@ -29,11 +25,7 @@
def nameless_checker(resource, ref, cloud_name):
item_id = None
resp_key = response_keys[resource]
- resp = resource_lists[resource](cloud_name=cloud_name)
- try:
- resp = resp[resp_key]
- except KeyError:
- raise common.ResourceNotFound(resp_key, ref)
+ resp = resource_lists[resource](cloud_name=cloud_name)[resp_key]
for item in resp:
if item["name"] == ref:
if item_id is not None:
diff --git a/_modules/cinderv3/common.py b/_modules/cinderv3/common.py
index 4edd604..bc77cd9 100644
--- a/_modules/cinderv3/common.py
+++ b/_modules/cinderv3/common.py
@@ -88,7 +88,7 @@
else:
response = getattr(adapter, method)(url)
except Exception as e:
- if hasattr(e, 'http_status') and (e.http_status >= 500
+ if not hasattr(e, 'http_status') or (e.http_status >= 500
or e.http_status == 0):
msg = ("Got retriable exception when contacting "
"Cinder API. Sleeping for %ss. Attepmpts "