Merge "[Part8] Remove six"
This commit is contained in:
commit
628694282c
@ -15,7 +15,6 @@
|
||||
|
||||
import falcon
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.i18n import _
|
||||
@ -90,7 +89,7 @@ class CollectionResource(object):
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Claim could not be created.')
|
||||
@ -140,7 +139,7 @@ class ItemResource(object):
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
except Exception:
|
||||
description = _(u'Claim could not be queried.')
|
||||
LOG.exception(description)
|
||||
@ -178,11 +177,11 @@ class ItemResource(object):
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Claim could not be updated.')
|
||||
|
@ -16,7 +16,6 @@
|
||||
import falcon
|
||||
import jsonschema
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from zaqar.common.api.schemas import flavors as schema
|
||||
from zaqar.common import decorators
|
||||
@ -74,7 +73,7 @@ class Listing(object):
|
||||
self._validate.flavor_listing(**store)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
cursor = self._ctrl.list(project=project_id, **store)
|
||||
flavors = list(next(cursor))
|
||||
@ -161,7 +160,7 @@ class Resource(object):
|
||||
|
||||
except errors.FlavorDoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
data['href'] = request.path
|
||||
|
||||
@ -287,7 +286,7 @@ class Resource(object):
|
||||
self._ctrl.get(flavor, project=project_id)
|
||||
except errors.FlavorDoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
flavor_obj = {}
|
||||
flavor_obj['name'] = flavor
|
||||
@ -312,7 +311,7 @@ class Resource(object):
|
||||
for cap in capabilities]
|
||||
except errors.FlavorDoesNotExist as ex:
|
||||
LOG.exception('Flavor "%s" does not exist', flavor)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
# (gengchc) Update flavor field in new pool list.
|
||||
try:
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import falcon
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.common.transport.wsgi import helpers as wsgi_helpers
|
||||
@ -69,7 +68,7 @@ class CollectionResource(object):
|
||||
project_id)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
except storage_errors.QueueDoesNotExist:
|
||||
LOG.exception('Queue name "%s" does not exist', queue_name)
|
||||
queue_meta = None
|
||||
@ -139,7 +138,7 @@ class CollectionResource(object):
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
except storage_errors.QueueDoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
@ -216,7 +215,7 @@ class CollectionResource(object):
|
||||
max_msg_post_size=queue_max_msg_size)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
# Deserialize and validate the incoming messages
|
||||
document = wsgi_utils.deserialize(req.stream, req.content_length)
|
||||
@ -243,11 +242,11 @@ class CollectionResource(object):
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
except storage_errors.MessageConflict:
|
||||
description = _(u'No messages could be enqueued.')
|
||||
@ -307,7 +306,7 @@ class CollectionResource(object):
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
if ids:
|
||||
resp.status = self._delete_messages_by_id(queue_name, ids,
|
||||
@ -390,7 +389,7 @@ class ItemResource(object):
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Message could not be retrieved.')
|
||||
|
@ -39,7 +39,6 @@ registered, there is an optional field:
|
||||
import falcon
|
||||
import jsonschema
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from zaqar.common.api.schemas import pools as schema
|
||||
from zaqar.common import decorators
|
||||
@ -97,7 +96,7 @@ class Listing(object):
|
||||
self._validate.pool_listing(**store)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
cursor = self._ctrl.list(**store)
|
||||
pools = list(next(cursor))
|
||||
@ -162,7 +161,7 @@ class Resource(object):
|
||||
|
||||
except errors.PoolDoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
data['href'] = request.path
|
||||
|
||||
@ -201,10 +200,10 @@ class Resource(object):
|
||||
except errors.PoolCapabilitiesMismatch as e:
|
||||
title = _(u'Unable to create pool')
|
||||
LOG.exception(title)
|
||||
raise falcon.HTTPBadRequest(title, six.text_type(e))
|
||||
raise falcon.HTTPBadRequest(title, str(e))
|
||||
except errors.PoolAlreadyExists as e:
|
||||
LOG.exception('Pool "%s" already exists', pool)
|
||||
raise wsgi_errors.HTTPConflict(six.text_type(e))
|
||||
raise wsgi_errors.HTTPConflict(str(e))
|
||||
|
||||
@decorators.TransportLog("Pools item")
|
||||
@acl.enforce("pools:delete")
|
||||
@ -272,7 +271,7 @@ class Resource(object):
|
||||
resp_data = self._ctrl.get(pool, False)
|
||||
except errors.PoolDoesNotExist as ex:
|
||||
LOG.exception('Pool "%s" does not exist', pool)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
resp_data['href'] = request.path
|
||||
response.body = transport_utils.to_json(resp_data)
|
||||
|
@ -15,7 +15,6 @@
|
||||
import falcon
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.i18n import _
|
||||
@ -52,7 +51,7 @@ class Resource(object):
|
||||
document = {'resource_types': ['messages', 'subscriptions']}
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
try:
|
||||
if "messages" in document['resource_types']:
|
||||
|
@ -16,7 +16,6 @@
|
||||
import copy
|
||||
import falcon
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.i18n import _
|
||||
@ -67,7 +66,7 @@ class ItemResource(object):
|
||||
resp_dict[meta] = value
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Queue metadata could not be retrieved.')
|
||||
@ -92,7 +91,7 @@ class ItemResource(object):
|
||||
self._validate.queue_metadata_putting(metadata)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
try:
|
||||
created = self._queue_controller.create(queue_name,
|
||||
@ -101,7 +100,7 @@ class ItemResource(object):
|
||||
|
||||
except storage_errors.FlavorDoesNotExist as ex:
|
||||
LOG.exception('Flavor "%s" does not exist', queue_name)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
except Exception:
|
||||
description = _(u'Queue could not be created.')
|
||||
LOG.exception(description)
|
||||
@ -145,7 +144,7 @@ class ItemResource(object):
|
||||
self._validate.queue_metadata_length(req.content_length)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestBody(str(ex))
|
||||
|
||||
# NOTE(flwang): See below link to get more details about draft 10,
|
||||
# tools.ietf.org/html/draft-ietf-appsawg-json-patch-10
|
||||
@ -205,10 +204,10 @@ class ItemResource(object):
|
||||
project_id)
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestBody(str(ex))
|
||||
except wsgi_errors.HTTPConflict:
|
||||
raise
|
||||
except Exception:
|
||||
@ -270,7 +269,7 @@ class CollectionResource(object):
|
||||
project=project_id)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Queues could not be listed.')
|
||||
|
@ -14,7 +14,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.i18n import _
|
||||
@ -70,7 +69,7 @@ class Resource(object):
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Queue stats could not be read.')
|
||||
|
@ -18,7 +18,6 @@ import falcon
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
from stevedore import driver
|
||||
|
||||
from zaqar.common import decorators
|
||||
@ -53,7 +52,7 @@ class ItemResource(object):
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Subscription could not be retrieved.')
|
||||
@ -95,13 +94,13 @@ class ItemResource(object):
|
||||
resp.location = req.path
|
||||
except storage_errors.SubscriptionDoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
except storage_errors.SubscriptionAlreadyExists as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPConflict(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPConflict(str(ex))
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
except Exception:
|
||||
description = (_(u'Subscription %(subscription_id)s could not be'
|
||||
' updated.') %
|
||||
@ -145,7 +144,7 @@ class CollectionResource(object):
|
||||
subscriptions = list(next(results))
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
|
||||
except Exception:
|
||||
description = _(u'Subscriptions could not be listed.')
|
||||
@ -200,7 +199,7 @@ class CollectionResource(object):
|
||||
project=project_id)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
except Exception:
|
||||
description = _(u'Subscription could not be created.')
|
||||
LOG.exception(description)
|
||||
@ -222,7 +221,7 @@ class CollectionResource(object):
|
||||
resp.location = req.path
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.body = utils.to_json(
|
||||
{'subscription_id': six.text_type(created)})
|
||||
{'subscription_id': str(created)})
|
||||
else:
|
||||
subscription = self._subscription_controller.get_with_subscriber(
|
||||
queue_name, subscriber, project_id)
|
||||
@ -243,7 +242,7 @@ class CollectionResource(object):
|
||||
resp.location = req.path
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.body = utils.to_json(
|
||||
{'subscription_id': six.text_type(subscription['id'])})
|
||||
{'subscription_id': str(subscription['id'])})
|
||||
|
||||
|
||||
class ConfirmResource(object):
|
||||
@ -291,10 +290,10 @@ class ConfirmResource(object):
|
||||
resp.location = req.path
|
||||
except storage_errors.SubscriptionDoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPNotFound(str(ex))
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
|
||||
except Exception:
|
||||
description = (_(u'Subscription %(subscription_id)s could not be'
|
||||
' confirmed.') %
|
||||
|
Loading…
Reference in New Issue
Block a user