Handle responses that lack expected resource
in the list/get decorator, handle situation when the response
is completely lacking the expected resource, and retry with the same
tenacity as in the send decorator (30 retries with 1 sec delay).
Change-Id: Id8dc6a82881dc387c934daf27a1c5b3419428214
Related-Issue: PROD-29647
diff --git a/_modules/neutronv2/arg_converter.py b/_modules/neutronv2/arg_converter.py
index 99cb8fe..79db479 100644
--- a/_modules/neutronv2/arg_converter.py
+++ b/_modules/neutronv2/arg_converter.py
@@ -2,6 +2,7 @@
from neutronv2 import common
import functools
import inspect
+import time
from uuid import UUID
@@ -51,8 +52,14 @@
else:
# Then we have name not uuid
resp_key = response_keys[resource]
- resp = resource_lists[resource](
- name=ref, cloud_name=cloud_name)[resp_key]
+ retries = 30
+ while retries:
+ resp = resource_lists[resource](
+ name=ref, cloud_name=cloud_name).get(resp_key)
+ if resp is not None:
+ break
+ retries -= 1
+ time.sleep(1)
if len(resp) == 0:
raise common.ResourceNotFound(resp_key, ref)
elif len(resp) > 1: