RestClient remove wait parameter from the get method
is_resource_deleted in the past worked like a wait method in several
cases.
Now we can safely remove the additional wait arguments form the
RestClient method signatures.
Change-Id: Ieebdef3d10876e6906ead8554680e2486ec8ce07
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index c582826..5ce3be6 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -177,8 +177,8 @@
def post(self, url, body, headers):
return self.request('POST', url, headers, body)
- def get(self, url, headers=None, wait=None):
- return self.request('GET', url, headers, wait=wait)
+ def get(self, url, headers=None):
+ return self.request('GET', url, headers)
def delete(self, url, headers=None):
return self.request('DELETE', url, headers)
@@ -257,7 +257,7 @@
self.LOG.warning("status >= 400 response with empty body")
def request(self, method, url,
- headers=None, body=None, depth=0, wait=None):
+ headers=None, body=None, depth=0):
"""A simple HTTP request interface."""
if (self.token is None) or (self.base_url is None):
@@ -276,13 +276,12 @@
self._log_response(resp, resp_body)
self.response_checker(method, url, headers, body, resp, resp_body)
- self._error_checker(method, url, headers, body, resp, resp_body, depth,
- wait)
+ self._error_checker(method, url, headers, body, resp, resp_body, depth)
return resp, resp_body
def _error_checker(self, method, url,
- headers, body, resp, resp_body, depth=0, wait=None):
+ headers, body, resp, resp_body, depth=0):
# NOTE(mtreinish): Check for httplib response from glance_http. The
# object can't be used here because importing httplib breaks httplib2.
@@ -336,7 +335,7 @@
resp_body = self._parse_resp(resp_body)
#Checking whether Absolute/Rate limit
return self.check_over_limit(resp_body, method, url, headers, body,
- depth, wait)
+ depth)
if resp.status == 422:
if parse_resp:
@@ -367,11 +366,11 @@
raise exceptions.RestClientException(str(resp.status))
def check_over_limit(self, resp_body, method, url,
- headers, body, depth, wait):
+ headers, body, depth):
self.is_absolute_limit(resp_body['overLimit'])
return self.is_rate_limit_retry_max_recursion_depth(
resp_body['overLimit'], method, url, headers,
- body, depth, wait)
+ body, depth)
def is_absolute_limit(self, resp_body):
if 'exceeded' in resp_body['message']:
@@ -380,15 +379,14 @@
return
def is_rate_limit_retry_max_recursion_depth(self, resp_body, method,
- url, headers, body, depth,
- wait):
+ url, headers, body, depth):
if 'retryAfter' in resp_body:
if depth < MAX_RECURSION_DEPTH:
delay = resp_body['retryAfter']
time.sleep(int(delay))
return self.request(method, url, headers=headers,
body=body,
- depth=depth + 1, wait=wait)
+ depth=depth + 1)
else:
raise exceptions.RateLimitExceeded(
message=resp_body['overLimitFault']['message'],
@@ -422,8 +420,8 @@
return xml_to_json(etree.fromstring(body))
def check_over_limit(self, resp_body, method, url,
- headers, body, depth, wait):
+ headers, body, depth):
self.is_absolute_limit(resp_body)
return self.is_rate_limit_retry_max_recursion_depth(
resp_body, method, url, headers,
- body, depth, wait)
+ body, depth)
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index e4271d9..d12b97b 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -53,10 +53,10 @@
body = json.loads(body)
return resp, body['volumes']
- def get_volume(self, volume_id, wait=None):
+ def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "os-volumes/%s" % str(volume_id)
- resp, body = self.get(url, wait=wait)
+ resp, body = self.get(url)
body = json.loads(body)
return resp, body['volume']
diff --git a/tempest/services/compute/xml/volumes_extensions_client.py b/tempest/services/compute/xml/volumes_extensions_client.py
index 69b9bac..06cfcfb 100644
--- a/tempest/services/compute/xml/volumes_extensions_client.py
+++ b/tempest/services/compute/xml/volumes_extensions_client.py
@@ -81,10 +81,10 @@
volumes += [self._parse_volume(vol) for vol in list(body)]
return resp, volumes
- def get_volume(self, volume_id, wait=None):
+ def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "os-volumes/%s" % str(volume_id)
- resp, body = self.get(url, self.headers, wait=wait)
+ resp, body = self.get(url, self.headers)
body = etree.fromstring(body)
return resp, self._parse_volume(body)
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index 277075e..cd2b57c 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -191,15 +191,15 @@
body = json.loads(body)
return resp, body['images']
- def get_image(self, image_id, wait=None):
+ def get_image(self, image_id):
url = 'v1/images/%s' % image_id
- resp, __ = self.get(url, wait=wait)
+ resp, __ = self.get(url)
body = self._image_meta_from_headers(resp)
return resp, body
def is_resource_deleted(self, id):
try:
- self.get_image(id, wait=True)
+ self.get_image(id)
except exceptions.NotFound:
return True
return False
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index fec273c..a71a287 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -103,7 +103,7 @@
self.service = self.config.object_storage.catalog_type
self.format = 'json'
- def request(self, method, url, headers=None, body=None, wait=None):
+ def request(self, method, url, headers=None, body=None):
"""A simple HTTP request interface."""
self.http_obj = httplib2.Http()
if headers is None:
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index ac1859a..9626b6b 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -156,7 +156,7 @@
self.service = self.config.object_storage.catalog_type
self.format = 'json'
- def request(self, method, url, headers=None, body=None, wait=None):
+ def request(self, method, url, headers=None, body=None):
"""A simple HTTP request interface."""
dscv = self.config.identity.disable_ssl_certificate_validation
self.http_obj = httplib2.Http(disable_ssl_certificate_validation=dscv)
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index ff1556f..6b0befd 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -56,10 +56,10 @@
body = json.loads(body)
return resp, body['volumes']
- def get_volume(self, volume_id, wait=None):
+ def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id)
- resp, body = self.get(url, wait=wait)
+ resp, body = self.get(url)
body = json.loads(body)
return resp, body['volume']
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index 5041869..4c15256 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -84,10 +84,10 @@
volumes += [self._parse_volume(vol) for vol in list(body)]
return resp, volumes
- def get_volume(self, volume_id, wait=None):
+ def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id)
- resp, body = self.get(url, self.headers, wait=wait)
+ resp, body = self.get(url, self.headers)
body = etree.fromstring(body)
return resp, self._parse_volume(body)