Remove XML related code from RestClient

XML API tests have been removed, but there is still some code related
to XML API tests in RestClient class.
This patch remove it for code cleanup.

Change-Id: I098fe348220bb24c022c4b0753da322e1cdb1893
This commit is contained in:
Ken'ichi Ohmichi 2014-12-10 14:09:18 +00:00
parent c5fa893e61
commit 938e3330e2
2 changed files with 5 additions and 28 deletions

View File

@ -76,18 +76,6 @@ class RestClient(object):
TYPE = "json"
# This is used by _parse_resp method
# Redefine it for purposes of your xml service client
# List should contain top-xml_tag-names of data, which is like list/array
# For example, in keystone it is users, roles, tenants and services
# All of it has children with same tag-names
list_tags = []
# This is used by _parse_resp method too
# Used for selection of dict-like xmls,
# like metadata for Vms in nova, and volumes in cinder
dict_tags = ["metadata", ]
LOG = logging.getLogger(__name__)
def __init__(self, auth_provider):
@ -495,9 +483,8 @@ class RestClient(object):
# (and occasionally swift) are using.
TXT_ENC = ['text/plain', 'text/html', 'text/html; charset=utf-8',
'text/plain; charset=utf-8']
XML_ENC = ['application/xml', 'application/xml; charset=utf-8']
if ctype.lower() in JSON_ENC or ctype.lower() in XML_ENC:
if ctype.lower() in JSON_ENC:
parse_resp = True
elif ctype.lower() in TXT_ENC:
parse_resp = False
@ -569,13 +556,10 @@ class RestClient(object):
if (not isinstance(resp_body, collections.Mapping) or
'retry-after' not in resp):
return True
if self._get_type() is "json":
over_limit = resp_body.get('overLimit', None)
if not over_limit:
return True
return 'exceed' in over_limit.get('message', 'blabla')
elif self._get_type() is "xml":
return 'exceed' in resp_body.get('message', 'blabla')
over_limit = resp_body.get('overLimit', None)
if not over_limit:
return True
return 'exceed' in over_limit.get('message', 'blabla')
def wait_for_resource_deletion(self, id):
"""Waits for a resource to be deleted."""

View File

@ -26,10 +26,6 @@ class IdentityClientJSON(rest_client.RestClient):
self.service = CONF.identity.catalog_type
self.endpoint_url = 'adminURL'
# Needed for xml service client
self.list_tags = ["roles", "tenants", "users", "services",
"extensions"]
def has_admin_extensions(self):
"""
Returns True if the KSADM Admin Extensions are supported
@ -335,9 +331,6 @@ class TokenClientJSON(IdentityClientJSON):
body=None):
"""A simple HTTP request interface."""
if headers is None:
# Always accept 'json', for TokenClientXML too.
# Because XML response is not easily
# converted to the corresponding JSON one
headers = self.get_headers(accept_type="json")
elif extra_headers:
try: