Drop unicode prefix

In Python 3 all strings are unicode, so the prefix has no effect. Drop
it to make all string value definition consistent.

Change-Id: I8eeb30b7bba8346dbaaf4f387f831a8733f4ad80
This commit is contained in:
Takashi Kajinami 2024-11-02 19:33:46 +09:00
parent 4543e7691c
commit b410da1154
73 changed files with 421 additions and 421 deletions

View File

@ -56,7 +56,7 @@ class Endpoints(object):
"""
project_id = req._headers.get('X-Project-ID')
LOG.debug(u'Queue list - project: %(project)s',
LOG.debug('Queue list - project: %(project)s',
{'project': project_id})
try:
@ -96,7 +96,7 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
metadata = req._body.get('metadata', {})
LOG.debug(u'Queue create - queue: %(queue)s, project: %(project)s',
LOG.debug('Queue create - queue: %(queue)s, project: %(project)s',
{'queue': queue_name,
'project': project_id})
@ -133,7 +133,7 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Queue delete - queue: %(queue)s, project: %(project)s',
LOG.debug('Queue delete - queue: %(queue)s, project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
self._queue_controller.delete(queue_name, project=project_id)
@ -159,8 +159,8 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Queue get - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Queue get - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
@ -193,8 +193,8 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Get queue stats - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Get queue stats - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
@ -236,8 +236,8 @@ class Endpoints(object):
resource_types = req._body.get('resource_types', ["messages",
"subscriptions"])
LOG.debug(u'Purge queue - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Purge queue - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
@ -286,8 +286,8 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Message list - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Message list - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
@ -340,8 +340,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
message_id = req._body.get('message_id')
LOG.debug(u'Message get - message: %(message)s, '
u'queue: %(queue)s, project: %(project)s',
LOG.debug('Message get - message: %(message)s, '
'queue: %(queue)s, project: %(project)s',
{'message': message_id,
'queue': queue_name,
'project': project_id})
@ -377,8 +377,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
message_ids = list(req._body.get('message_ids'))
LOG.debug(u'Message get - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Message get - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
@ -414,15 +414,15 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Messages post - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Messages post - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
messages = req._body.get('messages')
if messages is None:
ex = _(u'Invalid request.')
error = _(u'No messages were found in the request body.')
ex = _('Invalid request.')
error = _('No messages were found in the request body.')
headers = {'status': 400}
return api_utils.error_response(req, ex, headers, error)
@ -489,7 +489,7 @@ class Endpoints(object):
headers = {'status': 404}
return api_utils.error_response(req, ex, headers)
except storage_errors.MessageConflict as ex:
error = _(u'No messages could be enqueued.')
error = _('No messages could be enqueued.')
headers = {'status': 500}
LOG.exception(error)
return api_utils.error_response(req, ex, headers, error)
@ -513,8 +513,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
message_id = req._body.get('message_id')
LOG.debug(u'Messages item DELETE - message: %(message)s, '
u'queue: %(queue)s, project: %(project)s',
LOG.debug('Messages item DELETE - message: %(message)s, '
'queue: %(queue)s, project: %(project)s',
{'message': message_id,
'queue': queue_name,
'project': project_id})
@ -529,20 +529,20 @@ class Endpoints(object):
claim=claim_id)
except storage_errors.MessageNotClaimed as ex:
LOG.debug(ex)
error = _(u'A claim was specified, but the message '
u'is not currently claimed.')
error = _('A claim was specified, but the message '
'is not currently claimed.')
headers = {'status': 400}
return api_utils.error_response(req, ex, headers, error)
except storage_errors.ClaimDoesNotExist as ex:
LOG.debug(ex)
error = _(u'The specified claim does not exist or '
u'has expired.')
error = _('The specified claim does not exist or '
'has expired.')
headers = {'status': 400}
return api_utils.error_response(req, ex, headers, error)
except storage_errors.NotPermitted as ex:
LOG.debug(ex)
error = _(u'This message is claimed; it cannot be '
u'deleted without a valid claim ID.')
error = _('This message is claimed; it cannot be '
'deleted without a valid claim ID.')
headers = {'status': 403}
return api_utils.error_response(req, ex, headers, error)
@ -568,8 +568,8 @@ class Endpoints(object):
claim_ids = req._body.get('claim_ids')
pop_limit = req._body.get('pop')
LOG.debug(u'Messages collection DELETE - queue: %(queue)s,'
u'project: %(project)s, messages: %(message_ids)s',
LOG.debug('Messages collection DELETE - queue: %(queue)s,'
'project: %(project)s, messages: %(message_ids)s',
{'queue': queue_name, 'project': project_id,
'message_ids': message_ids})
@ -602,7 +602,7 @@ class Endpoints(object):
@api_utils.on_exception_sends_500
def _pop_messages(self, req, queue_name, project_id, pop_limit):
LOG.debug(u'Pop messages - queue: %(queue)s, project: %(project)s',
LOG.debug('Pop messages - queue: %(queue)s, project: %(project)s',
{'queue': queue_name, 'project': project_id})
messages = self._message_controller.pop(
@ -632,8 +632,8 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Claims create - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Claims create - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
self._claim_post_spec = (
@ -699,8 +699,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
claim_id = req._body.get('claim_id')
LOG.debug(u'Claim get - claim: %(claim_id)s, '
u'queue: %(queue_name)s, project: %(project_id)s',
LOG.debug('Claim get - claim: %(claim_id)s, '
'queue: %(queue_name)s, project: %(project_id)s',
{'queue_name': queue_name,
'project_id': project_id,
'claim_id': claim_id})
@ -744,8 +744,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
claim_id = req._body.get('claim_id')
LOG.debug(u'Claim update - claim: %(claim_id)s, '
u'queue: %(queue_name)s, project:%(project_id)s',
LOG.debug('Claim update - claim: %(claim_id)s, '
'queue: %(queue_name)s, project:%(project_id)s',
{'queue_name': queue_name,
'project_id': project_id,
'claim_id': claim_id})
@ -791,8 +791,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
claim_id = req._body.get('claim_id')
LOG.debug(u'Claim delete - claim: %(claim_id)s, '
u'queue: %(queue_name)s, project: %(project_id)s',
LOG.debug('Claim delete - claim: %(claim_id)s, '
'queue: %(queue_name)s, project: %(project_id)s',
{'queue_name': queue_name,
'project_id': project_id,
'claim_id': claim_id})
@ -819,7 +819,7 @@ class Endpoints(object):
project_id = req._headers.get('X-Project-ID')
queue_name = req._body.get('queue_name')
LOG.debug(u'Subscription list - project: %(project)s',
LOG.debug('Subscription list - project: %(project)s',
{'project': project_id})
try:
@ -861,7 +861,7 @@ class Endpoints(object):
ttl = req._body.get('ttl', self._defaults.subscription_ttl)
LOG.debug(
u'Subscription create - queue: %(queue)s, project: %(project)s',
'Subscription create - queue: %(queue)s, project: %(project)s',
{'queue': queue_name,
'project': project_id})
@ -917,7 +917,7 @@ class Endpoints(object):
subscription_id = req._body.get('subscription_id')
LOG.debug(
u'Subscription delete - queue: %(queue)s, project: %(project)s',
'Subscription delete - queue: %(queue)s, project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
self._subscription_controller.delete(queue_name,
@ -948,8 +948,8 @@ class Endpoints(object):
queue_name = req._body.get('queue_name')
subscription_id = req._body.get('subscription_id')
LOG.debug(u'Subscription get - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Subscription get - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:

View File

@ -59,16 +59,16 @@ class Bootstrap(object):
@decorators.lazy_property(write=False)
def api(self):
LOG.debug(u'Loading API handler')
LOG.debug('Loading API handler')
validate = validation.Validator(self.conf)
defaults = base.ResourceDefaults(self.conf)
return handler.Handler(self.storage, self.control, validate, defaults)
@decorators.lazy_property(write=False)
def storage(self):
LOG.debug(u'Loading storage driver')
LOG.debug('Loading storage driver')
if self.conf.pooling:
LOG.debug(u'Storage pooling enabled')
LOG.debug('Storage pooling enabled')
storage_driver = pooling.DataDriver(self.conf, self.cache,
self.control)
if self.conf.profiler.enabled:
@ -78,19 +78,19 @@ class Bootstrap(object):
storage_driver = storage_utils.load_storage_driver(
self.conf, self.cache, control_driver=self.control)
LOG.debug(u'Loading storage pipeline')
LOG.debug('Loading storage pipeline')
return pipeline.DataDriver(self.conf, storage_driver,
self.control)
@decorators.lazy_property(write=False)
def control(self):
LOG.debug(u'Loading storage control driver')
LOG.debug('Loading storage control driver')
return storage_utils.load_storage_driver(self.conf, self.cache,
control_mode=True)
@decorators.lazy_property(write=False)
def cache(self):
LOG.debug(u'Loading proxy cache driver')
LOG.debug('Loading proxy cache driver')
try:
oslo_cache.register_config(self.conf)
return oslo_cache.get_cache(self.conf)
@ -101,7 +101,7 @@ class Bootstrap(object):
@decorators.lazy_property(write=False)
def transport(self):
transport_name = self.driver_conf.transport
LOG.debug(u'Loading transport driver: %s', transport_name)
LOG.debug('Loading transport driver: %s', transport_name)
if transport_name == consts.TRANSPORT_WEBSOCKET:
args = [self.conf, self.api, self.cache]
@ -120,8 +120,8 @@ class Bootstrap(object):
invoke_args=args)
return mgr.driver
except RuntimeError as exc:
LOG.exception(u'Failed to load transport driver zaqar.transport.'
u'%(driver)s with args %(args)s',
LOG.exception('Failed to load transport driver zaqar.transport.'
'%(driver)s with args %(args)s',
{'driver': transport_name, 'args': args})
raise errors.InvalidDriver(exc)

View File

@ -31,5 +31,5 @@ def run():
server = bootstrap.Bootstrap(conf)
LOG.debug(u'Calling the garbage collector')
LOG.debug('Calling the garbage collector')
server.storage.gc()

View File

@ -26,7 +26,7 @@ class ExceptionBase(Exception):
class BadRequest(ExceptionBase):
"""Raised when an invalid request is received."""
msg_format = u'Bad request. {description}'
msg_format = 'Bad request. {description}'
def __init__(self, description):
"""Initializes the error with contextual information.

View File

@ -67,7 +67,7 @@ def sanitize(document, spec=None, doctype=dict):
return [filter_fields(obj, spec) for obj in document]
raise TypeError(_(u'Doctype must be either a JSONObject or JSONArray'))
raise TypeError(_('Doctype must be either a JSONObject or JSONArray'))
def filter_fields(document, spec):
@ -119,7 +119,7 @@ def get_checked_field(document, name, value_type, default_value):
if default_value is not None:
value = default_value
else:
description = _(u'Missing "{name}" field.').format(name=name)
description = _('Missing "{name}" field.').format(name=name)
raise api_errors.BadRequest(description)
# PERF(kgriffs): We do our own little spec thing because it is way
@ -127,7 +127,7 @@ def get_checked_field(document, name, value_type, default_value):
if value_type == '*' or isinstance(value, value_type):
return value
description = _(u'The value of the "{name}" field must be a {vtype}.')
description = _('The value of the "{name}" field must be a {vtype}.')
description = description.format(name=name, vtype=value_type.__name__)
raise api_errors.BadRequest(description)

View File

@ -50,7 +50,7 @@ def runnable(func):
logging.setup(CONF, 'zaqar')
func()
except KeyboardInterrupt:
LOG.info(u'Terminating')
LOG.info('Terminating')
except Exception as ex:
_fail(1, ex)

View File

@ -41,7 +41,7 @@ class TransportLog(object):
# and returns 'GET' and 'PATCH' respectively, so we do not need
# the name of the HTTP method to be passed.
method = func.__name__[3:].upper()
LOG.debug(u'%(type)s %(method)s: %(arguments)s',
LOG.debug('%(type)s %(method)s: %(arguments)s',
{'type': self.resource_type,
'method': method,
'arguments': jsonutils.dumps(kwargs)})

View File

@ -106,7 +106,7 @@ class Pipeline(object):
return result
if target is None:
msg = _(u'Method %s not found in any of '
msg = _('Method %s not found in any of '
'the registered stages') % method
LOG.error(msg)
raise AttributeError(msg)

View File

@ -177,8 +177,8 @@ def validate_queue_identification(validate, req, resp, params):
project = params['project_id']
queue = params['queue_name']
LOG.debug(u'Invalid queue name "%(queue)s" submitted for '
u'project: %(project)s',
LOG.debug('Invalid queue name "%(queue)s" submitted for '
'project: %(project)s',
{'queue': queue, 'project': project})
raise falcon.HTTPBadRequest(

View File

@ -41,9 +41,9 @@ class Conflict(ExceptionBase):
class MessageConflict(Conflict):
msg_format = (u'Message could not be enqueued due to a conflict '
u'with one or more other messages that are already in '
u'queue {queue} for project {project}')
msg_format = ('Message could not be enqueued due to a conflict '
'with one or more other messages that are already in '
'queue {queue} for project {project}')
def __init__(self, queue, project):
"""Initializes the error with contextual information.
@ -58,9 +58,9 @@ class MessageConflict(Conflict):
class ClaimConflict(Conflict):
msg_format = (u'Messages could not be claimed due to a conflict '
u'with another parallel claim that is already in '
u'queue {queue} for project {project}')
msg_format = ('Messages could not be claimed due to a conflict '
'with another parallel claim that is already in '
'queue {queue} for project {project}')
def __init__(self, queue, project):
"""Initializes the error with contextual information.
@ -74,7 +74,7 @@ class ClaimConflict(Conflict):
class QueueDoesNotExist(DoesNotExist):
msg_format = u'Queue {name} does not exist for project {project}'
msg_format = 'Queue {name} does not exist for project {project}'
def __init__(self, name, project):
super(QueueDoesNotExist, self).__init__(name=name, project=project)
@ -82,7 +82,7 @@ class QueueDoesNotExist(DoesNotExist):
class QueueIsEmpty(ExceptionBase):
msg_format = u'Queue {name} in project {project} is empty'
msg_format = 'Queue {name} in project {project} is empty'
def __init__(self, name, project):
super(QueueIsEmpty, self).__init__(name=name, project=project)
@ -90,8 +90,8 @@ class QueueIsEmpty(ExceptionBase):
class MessageDoesNotExist(DoesNotExist):
msg_format = (u'Message {mid} does not exist in '
u'queue {queue} for project {project}')
msg_format = ('Message {mid} does not exist in '
'queue {queue} for project {project}')
def __init__(self, mid, queue, project):
super(MessageDoesNotExist, self).__init__(mid=mid, queue=queue,
@ -100,8 +100,8 @@ class MessageDoesNotExist(DoesNotExist):
class ClaimDoesNotExist(DoesNotExist):
msg_format = (u'Claim {cid} does not exist in '
u'queue {queue} for project {project}')
msg_format = ('Claim {cid} does not exist in '
'queue {queue} for project {project}')
def __init__(self, cid, queue, project):
super(ClaimDoesNotExist, self).__init__(cid=cid, queue=queue,
@ -110,8 +110,8 @@ class ClaimDoesNotExist(DoesNotExist):
class ClaimDoesNotMatch(ExceptionBase):
msg_format = (u'Claim {cid} does not exist in the claim_ids parameter in'
u'queue {queue} for project {project}')
msg_format = ('Claim {cid} does not exist in the claim_ids parameter in'
'queue {queue} for project {project}')
def __init__(self, cid, queue, project):
super(ClaimDoesNotMatch, self).__init__(cid=cid, queue=queue,
@ -120,7 +120,7 @@ class ClaimDoesNotMatch(ExceptionBase):
class MessageIsClaimed(NotPermitted):
msg_format = u'Message {mid} is claimed'
msg_format = 'Message {mid} is claimed'
def __init__(self, mid):
super(MessageIsClaimed, self).__init__(mid=mid)
@ -128,7 +128,7 @@ class MessageIsClaimed(NotPermitted):
class MessageNotClaimed(NotPermitted):
msg_format = u'Message {mid} is no longer claimed'
msg_format = 'Message {mid} is no longer claimed'
def __init__(self, mid):
super(MessageNotClaimed, self).__init__(mid=mid)
@ -136,7 +136,7 @@ class MessageNotClaimed(NotPermitted):
class MessageNotClaimedBy(NotPermitted):
msg_format = u'Message {mid} is not claimed by {cid}'
msg_format = 'Message {mid} is not claimed by {cid}'
def __init__(self, mid, cid):
super(MessageNotClaimedBy, self).__init__(cid=cid, mid=mid)
@ -144,8 +144,8 @@ class MessageNotClaimedBy(NotPermitted):
class QueueNotMapped(DoesNotExist):
msg_format = (u'No pool found for '
u'queue {queue} for project {project}')
msg_format = ('No pool found for '
'queue {queue} for project {project}')
def __init__(self, queue, project):
super(QueueNotMapped, self).__init__(queue=queue, project=project)
@ -153,7 +153,7 @@ class QueueNotMapped(DoesNotExist):
class PoolDoesNotExist(DoesNotExist):
msg_format = u'Pool {pool} does not exist'
msg_format = 'Pool {pool} does not exist'
def __init__(self, pool):
super(PoolDoesNotExist, self).__init__(pool=pool)
@ -161,7 +161,7 @@ class PoolDoesNotExist(DoesNotExist):
class PoolGroupDoesNotExist(DoesNotExist):
msg_format = u'Pool group {pool_group} does not exist'
msg_format = 'Pool group {pool_group} does not exist'
def __init__(self, pool_group):
super(PoolGroupDoesNotExist, self).__init__(pool_group=pool_group)
@ -169,7 +169,7 @@ class PoolGroupDoesNotExist(DoesNotExist):
class FlavorDoesNotExist(DoesNotExist):
msg_format = u'Flavor {flavor} does not exist'
msg_format = 'Flavor {flavor} does not exist'
def __init__(self, flavor):
super(FlavorDoesNotExist, self).__init__(flavor=flavor)
@ -177,7 +177,7 @@ class FlavorDoesNotExist(DoesNotExist):
class NoPoolFound(ExceptionBase):
msg_format = u'No pools registered'
msg_format = 'No pools registered'
def __init__(self):
super(NoPoolFound, self).__init__()
@ -185,7 +185,7 @@ class NoPoolFound(ExceptionBase):
class PoolInUseByFlavor(NotPermitted):
msg_format = u'Pool {pid} is in use by flavor {fid}'
msg_format = 'Pool {pid} is in use by flavor {fid}'
def __init__(self, pid, fid):
super(PoolInUseByFlavor, self).__init__(pid=pid, fid=fid)
@ -198,7 +198,7 @@ class PoolInUseByFlavor(NotPermitted):
class SubscriptionDoesNotExist(DoesNotExist):
msg_format = u'Subscription {subscription_id} does not exist'
msg_format = 'Subscription {subscription_id} does not exist'
def __init__(self, subscription_id):
super(SubscriptionDoesNotExist,
@ -207,29 +207,29 @@ class SubscriptionDoesNotExist(DoesNotExist):
class PoolCapabilitiesMismatch(ExceptionBase):
msg_format = (u'The pool being added does not '
u'support the minimum set of capabilities')
msg_format = ('The pool being added does not '
'support the minimum set of capabilities')
class PoolAlreadyExists(Conflict):
msg_format = u'The database URI is in use by another pool.'
msg_format = 'The database URI is in use by another pool.'
class PoolRedisNotSupportGroup(ExceptionBase):
msg_format = (u'Redis not support pool_goup, please use flavor ')
msg_format = ('Redis not support pool_goup, please use flavor ')
class SubscriptionAlreadyExists(Conflict):
msg_format = (u'Such subscription already exists. Subscriptions '
u'are unique by project + queue + subscriber URI.')
msg_format = ('Such subscription already exists. Subscriptions '
'are unique by project + queue + subscriber URI.')
class TopicDoesNotExist(DoesNotExist):
msg_format = u'Topic {name} does not exist for project {project}'
msg_format = 'Topic {name} does not exist for project {project}'
def __init__(self, name, project):
super(TopicDoesNotExist, self).__init__(name=name, project=project)
@ -237,7 +237,7 @@ class TopicDoesNotExist(DoesNotExist):
class TopicIsEmpty(ExceptionBase):
msg_format = u'Topic {name} in project {project} is empty'
msg_format = 'Topic {name} in project {project} is empty'
def __init__(self, name, project):
super(TopicIsEmpty, self).__init__(name=name, project=project)

View File

@ -269,8 +269,8 @@ class MessageController(storage.Message):
"""
if sort not in (1, -1):
raise ValueError(u'sort must be either 1 (ascending) '
u'or -1 (descending)')
raise ValueError('sort must be either 1 (ascending) '
'or -1 (descending)')
now = timeutils.utcnow_ts()
@ -484,9 +484,9 @@ class MessageController(storage.Message):
# NOTE(kgriffs): Since we did not filter by a time window,
# the queue should have been found and updated. Perhaps
# the queue has been deleted?
message = (u'Failed to increment the message '
u'counter for queue %(name)s and '
u'project %(project)s')
message = ('Failed to increment the message '
'counter for queue %(name)s and '
'project %(project)s')
message %= dict(name=queue_name, project=project)
LOG.warning(message)
@ -917,9 +917,9 @@ class FIFOMessageController(MessageController):
# Log a message if we retried, for debugging perf issues
if attempt != 0:
msgtmpl = _(u'%(attempts)d attempt(s) required to post '
u'%(num_messages)d messages to queue '
u'"%(queue)s" under project %(project)s')
msgtmpl = _('%(attempts)d attempt(s) required to post '
'%(num_messages)d messages to queue '
'"%(queue)s" under project %(project)s')
LOG.debug(msgtmpl,
dict(queue=queue_name,
@ -962,9 +962,9 @@ class FIFOMessageController(MessageController):
#
# TODO(kgriffs): Add transaction ID to help match up loglines
if attempt == 0:
msgtmpl = _(u'First attempt failed while '
u'adding messages to queue '
u'"%(queue)s" under project %(project)s')
msgtmpl = _('First attempt failed while '
'adding messages to queue '
'"%(queue)s" under project %(project)s')
LOG.debug(msgtmpl, dict(queue=queue_name, project=project))
@ -976,8 +976,8 @@ class FIFOMessageController(MessageController):
# this situation can not happen.
elapsed = timeutils.utcnow_ts() - now
if elapsed > MAX_RETRY_POST_DURATION:
msgtmpl = (u'Exceeded maximum retry duration for queue '
u'"%(queue)s" under project %(project)s')
msgtmpl = ('Exceeded maximum retry duration for queue '
'"%(queue)s" under project %(project)s')
LOG.warning(msgtmpl,
dict(queue=queue_name, project=project))
@ -1020,10 +1020,10 @@ class FIFOMessageController(MessageController):
next_marker = self._get_counter(
queue_name, project)
else:
msgtmpl = (u'Detected a stalled message counter '
u'for queue "%(queue)s" under '
u'project %(project)s.'
u'The counter was incremented to %(value)d.')
msgtmpl = ('Detected a stalled message counter '
'for queue "%(queue)s" under '
'project %(project)s.'
'The counter was incremented to %(value)d.')
LOG.warning(msgtmpl,
dict(queue=queue_name,
@ -1036,8 +1036,8 @@ class FIFOMessageController(MessageController):
LOG.exception('Error parsing document')
raise
msgtmpl = (u'Hit maximum number of attempts (%(max)s) for queue '
u'"%(queue)s" under project %(project)s')
msgtmpl = ('Hit maximum number of attempts (%(max)s) for queue '
'"%(queue)s" under project %(project)s')
LOG.warning(msgtmpl,
dict(max=self.driver.mongodb_conf.max_attempts,

View File

@ -172,9 +172,9 @@ class QueueController(storage.Queue):
# NOTE(kgriffs): Since we did not filter by a time window,
# the queue should have been found and updated. Perhaps
# the queue has been deleted?
message = _(u'Failed to increment the message '
u'counter for queue %(name)s and '
u'project %(project)s')
message = _('Failed to increment the message '
'counter for queue %(name)s and '
'project %(project)s')
message %= dict(name=name, project=project)
LOG.warning(message)

View File

@ -240,8 +240,8 @@ class MessageController(storage.Message):
"""
if sort not in (1, -1):
raise ValueError(u'sort must be either 1 (ascending) '
u'or -1 (descending)')
raise ValueError('sort must be either 1 (ascending) '
'or -1 (descending)')
now = timeutils.utcnow_ts()
@ -389,9 +389,9 @@ class MessageController(storage.Message):
# NOTE(kgriffs): Since we did not filter by a time window,
# the topic should have been found and updated. Perhaps
# the topic has been deleted?
message = (u'Failed to increment the message '
u'counter for topic %(name)s and '
u'project %(project)s')
message = ('Failed to increment the message '
'counter for topic %(name)s and '
'project %(project)s')
message %= dict(name=topic_name, project=project)
LOG.warning(message)
@ -815,9 +815,9 @@ class FIFOMessageController(MessageController):
# Log a message if we retried, for debugging perf issues
if attempt != 0:
msgtmpl = _(u'%(attempts)d attempt(s) required to post '
u'%(num_messages)d messages to queue '
u'"%(topic)s" under project %(project)s')
msgtmpl = _('%(attempts)d attempt(s) required to post '
'%(num_messages)d messages to queue '
'"%(topic)s" under project %(project)s')
LOG.debug(msgtmpl,
dict(topic=topic_name,
@ -860,9 +860,9 @@ class FIFOMessageController(MessageController):
#
# TODO(kgriffs): Add transaction ID to help match up loglines
if attempt == 0:
msgtmpl = _(u'First attempt failed while '
u'adding messages to topic '
u'"%(topic)s" under project %(project)s')
msgtmpl = _('First attempt failed while '
'adding messages to topic '
'"%(topic)s" under project %(project)s')
LOG.debug(msgtmpl, dict(topic=topic_name, project=project))
@ -874,8 +874,8 @@ class FIFOMessageController(MessageController):
# this situation can not happen.
elapsed = timeutils.utcnow_ts() - now
if elapsed > MAX_RETRY_POST_DURATION:
msgtmpl = (u'Exceeded maximum retry duration for topic '
u'"%(topic)s" under project %(project)s')
msgtmpl = ('Exceeded maximum retry duration for topic '
'"%(topic)s" under project %(project)s')
LOG.warning(msgtmpl,
dict(topic=topic_name, project=project))
@ -918,10 +918,10 @@ class FIFOMessageController(MessageController):
next_marker = self._get_counter(
topic_name, project)
else:
msgtmpl = (u'Detected a stalled message counter '
u'for topic "%(topic)s" under '
u'project %(project)s.'
u'The counter was incremented to %(value)d.')
msgtmpl = ('Detected a stalled message counter '
'for topic "%(topic)s" under '
'project %(project)s.'
'The counter was incremented to %(value)d.')
LOG.warning(msgtmpl,
dict(topic=topic_name,
@ -934,8 +934,8 @@ class FIFOMessageController(MessageController):
LOG.exception('Error parsing document.')
raise
msgtmpl = (u'Hit maximum number of attempts (%(max)s) for topic '
u'"%(topic)s" under project %(project)s')
msgtmpl = ('Hit maximum number of attempts (%(max)s) for topic '
'"%(topic)s" under project %(project)s')
LOG.warning(msgtmpl,
dict(max=self.driver.mongodb_conf.max_attempts,

View File

@ -156,9 +156,9 @@ class TopicController(storage.Topic):
# NOTE(kgriffs): Since we did not filter by a time window,
# the topic should have been found and updated. Perhaps
# the topic has been deleted?
message = _(u'Failed to increment the message '
u'counter for topic %(name)s and '
u'project %(project)s')
message = _('Failed to increment the message '
'counter for topic %(name)s and '
'project %(project)s')
message %= dict(name=name, project=project)
LOG.warning(message)

View File

@ -88,13 +88,13 @@ def calculate_backoff(attempt, max_attempts, max_sleep, max_jitter=0):
"""
if max_sleep < 0:
raise ValueError(u'max_sleep must be >= 0')
raise ValueError('max_sleep must be >= 0')
if max_jitter < 0:
raise ValueError(u'max_jitter must be >= 0')
raise ValueError('max_jitter must be >= 0')
if not (0 <= attempt < max_attempts):
raise ValueError(u'attempt value is out of range')
raise ValueError('attempt value is out of range')
ratio = attempt / max_attempts
backoff_sec = ratio * max_sleep
@ -126,7 +126,7 @@ def oid_ts(oid):
try:
return timeutils.delta_seconds(EPOCH, oid.generation_time)
except AttributeError:
raise TypeError(u'Expected ObjectId and got %s' % type(oid))
raise TypeError('Expected ObjectId and got %s' % type(oid))
def stat_message(message, now):

View File

@ -61,7 +61,7 @@ def _get_storage_pipeline(resource_name, conf, *args, **kwargs):
invoke_on_load=True)
pipeline.append(mgr.driver)
except RuntimeError as exc:
LOG.warning(u'Stage %(stage)s could not be imported: %(ex)s',
LOG.warning('Stage %(stage)s could not be imported: %(ex)s',
{'stage': ns, 'ex': str(exc)})
continue

View File

@ -527,7 +527,7 @@ class Catalog(object):
oldpoolids = catalogue['pool']
oldpool = self._pools_ctrl.get(oldpoolids)
oldflavor = oldpool['flavor']
msgtmpl = _(u'register queue to pool: old flavor: %(oldflavor)s '
msgtmpl = _('register queue to pool: old flavor: %(oldflavor)s '
', new flavor: %(flavor)s')
LOG.info(msgtmpl,
{'oldflavor': oldflavor, 'flavor': flavor})
@ -542,7 +542,7 @@ class Catalog(object):
detailed=True)
pool = select.weighted(pools)
pool = pool and pool['name'] or None
msgtmpl = _(u'register queue to pool: new flavor:%(flavor)s')
msgtmpl = _('register queue to pool: new flavor:%(flavor)s')
LOG.info(msgtmpl,
{'flavor': flavor.get('name', None)})
else:
@ -563,10 +563,10 @@ class Catalog(object):
if self.lookup(queue, project) is not None:
return
raise errors.NoPoolFound()
msgtmpl = _(u'register queue to pool: new flavor: None')
msgtmpl = _('register queue to pool: new flavor: None')
LOG.info(msgtmpl)
msgtmpl = _(u'register queue: project:%(project)s'
msgtmpl = _('register queue: project:%(project)s'
' queue:%(queue)s pool:%(pool)s')
LOG.info(msgtmpl,
{'project': project,

View File

@ -97,12 +97,12 @@ class CatalogueController(base.CatalogueBase):
try:
pipe.execute()
except redis.exceptions.ResponseError:
msgtmpl = _(u'CatalogueController:insert %(prj)s:'
msgtmpl = _('CatalogueController:insert %(prj)s:'
'%(queue)s %(pool)s failed')
LOG.exception(msgtmpl,
{'prj': project, 'queue': queue, 'pool': pool})
return False
msgtmpl = _(u'CatalogueController:insert %(prj)s:%(queue)s'
msgtmpl = _('CatalogueController:insert %(prj)s:%(queue)s'
':%(pool)s, success')
LOG.info(msgtmpl,
{'prj': project, 'queue': queue, 'pool': pool})
@ -182,12 +182,12 @@ class CatalogueController(base.CatalogueBase):
try:
pipe.execute()
except redis.exceptions.ResponseError:
msgtmpl = _(u'CatalogueController:delete %(prj)s'
msgtmpl = _('CatalogueController:delete %(prj)s'
':%(queue)s failed')
LOG.info(msgtmpl,
{'prj': project, 'queue': queue})
return False
msgtmpl = _(u'CatalogueController:delete %(prj)s:%(queue)s success')
msgtmpl = _('CatalogueController:delete %(prj)s:%(queue)s success')
LOG.info(msgtmpl,
{'prj': project, 'queue': queue})
@ -206,12 +206,12 @@ class CatalogueController(base.CatalogueBase):
try:
pipe.execute()
except redis.exceptions.ResponseError:
msgtmpl = _(u'CatalogueController:_update %(prj)s'
msgtmpl = _('CatalogueController:_update %(prj)s'
':%(queue)s:%(pool)s failed')
LOG.exception(msgtmpl,
{'prj': project, 'queue': queue, 'pool': pool})
return False
msgtmpl = _(u'CatalogueController:_update %(prj)s:%(queue)s'
msgtmpl = _('CatalogueController:_update %(prj)s:%(queue)s'
':%(pool)s')
LOG.info(msgtmpl,
{'prj': project, 'queue': queue, 'pool': pool})

View File

@ -366,8 +366,8 @@ class MessageController(storage.Message, scripting.Mixin):
@utils.retries_on_connection_error
def first(self, queue, project=None, sort=1):
if sort not in (1, -1):
raise ValueError(u'sort must be either 1 (ascending) '
u'or -1 (descending)')
raise ValueError('sort must be either 1 (ascending) '
'or -1 (descending)')
message_id = self._get_first_message_id(queue, project, sort)
if not message_id:

View File

@ -168,8 +168,8 @@ class MessageController(storage.Message):
def first(self, queue, project=None, sort=1):
if sort not in (1, -1):
raise ValueError(u'sort must be either 1 (ascending) '
u'or -1 (descending)')
raise ValueError('sort must be either 1 (ascending) '
'or -1 (descending)')
cursor = self._list(queue, project, limit=1, sort=sort)
try:
message = next(next(cursor))

View File

@ -48,7 +48,7 @@ def dynamic_conf(uri, options, conf=None):
# 'drivers:storage:{type}'
options['uri'] = uri
storage_opts = utils.dict_to_conf(options)
storage_group = u'drivers:message_store:%s' % storage_type
storage_group = 'drivers:message_store:%s' % storage_type
# NOTE(cpp-cabrera): register those options!
if conf is None:

View File

@ -212,7 +212,7 @@ class TestPools(base.V1_1FunctionalTestBase):
self.assertEqual(404, result.status_code)
@ddt.data(
{'name': u'\u6c49\u5b57\u6f22\u5b57'},
{'name': '\u6c49\u5b57\u6f22\u5b57'},
{'name': 'i'*65},
{'weight': -1}
)

View File

@ -98,7 +98,7 @@ class TestInsertQueue(base.V1_1FunctionalTestBase):
test_insert_queue.tags = ['positive', 'smoke']
@ddt.data(annotated('test_insert_queue_non_ascii_name',
u'\u6c49\u5b57\u6f22\u5b57'),
'\u6c49\u5b57\u6f22\u5b57'),
'@$@^qw',
annotated('test_insert_queue_invalid_name_length', 'i' * 65))
def test_insert_queue_invalid_name(self, queue_name):

View File

@ -137,7 +137,7 @@ def entries(controller, count):
:param count: int - number of entries to create
:returns: [(str, str, str, str)] - [(project, queue, partition, host)]
"""
spec = [(u'_', str(uuid.uuid1()), str(i),
spec = [('_', str(uuid.uuid1()), str(i),
str(i))
for i in range(count)]
@ -187,7 +187,7 @@ def pool_entries(controller, pool_ctrl, count):
:returns: [(project, queue, pool)]
:rtype: [(str, str, str)]
"""
spec = [(u'_', str(uuid.uuid1()), str(i))
spec = [('_', str(uuid.uuid1()), str(i))
for i in range(count)]
for p, q, s in spec:

View File

@ -50,9 +50,9 @@ class TestDecorators(base.TestBase):
cache = oslo_cache.get_cache(conf)
sample_project = {
u'name': u'Cats Abound',
u'bits': b'\x80\x81\x82\x83\x84',
b'key': u'Value. \x80',
'name': 'Cats Abound',
'bits': b'\x80\x81\x82\x83\x84',
b'key': 'Value. \x80',
}
def create_key(user, project=None):

View File

@ -1749,14 +1749,14 @@ class CatalogueControllerTest(ControllerBaseTest):
def test_list(self):
with helpers.pool_entries(self.controller,
self.pool_ctrl, 10) as expect:
values = zip(self.controller.list(u'_'), expect)
values = zip(self.controller.list('_'), expect)
for e, x in values:
p, q, s = x
self._check_structure(e)
self._check_value(e, xqueue=q, xproject=p, xpool=s)
def test_update(self):
p2 = u'b'
p2 = 'b'
# NOTE(gengchc2): Remove [group=self.pool_group] in
# it can be tested for redis as management.
self.pool_ctrl.create(p2, 100, '127.0.0.1',
@ -1787,7 +1787,7 @@ class CatalogueControllerTest(ControllerBaseTest):
def test_get_raises_if_does_not_exist(self):
with helpers.pool_entry(self.controller,
self.project,
self.queue, u'a') as expect:
self.queue, 'a') as expect:
p, q, _ = expect
self.assertRaises(errors.QueueNotMapped,
self.controller.get,
@ -1810,8 +1810,8 @@ class CatalogueControllerTest(ControllerBaseTest):
def test_insert(self):
q1 = str(uuid.uuid1())
q2 = str(uuid.uuid1())
self.controller.insert(self.project, q1, u'a')
self.controller.insert(self.project, q2, u'a')
self.controller.insert(self.project, q1, 'a')
self.controller.insert(self.project, q2, 'a')
# NOTE(gengchc2): Unittest for new flavor configure scenario.

View File

@ -140,10 +140,10 @@ class RedisUtilsTest(testing.TestBase):
now = timeutils.utcnow_ts()
body = {
'msg': 'Hello Earthlings!',
'unicode': u'ab\u00e7',
'unicode': 'ab\u00e7',
'bytes': b'ab\xc3\xa7',
b'ab\xc3\xa7': 'one, two, three',
u'ab\u00e7': 'one, two, three',
'ab\u00e7': 'one, two, three',
}
msg = _create_sample_message(now=now, body=body)

View File

@ -38,7 +38,7 @@ class TestMessagingProtocol(base.TestBase):
}
def test_on_message_with_invalid_input(self):
payload = u'\ufeff'
payload = '\ufeff'
send_mock = mock.Mock()
self.protocol.sendMessage = send_mock

View File

@ -231,7 +231,7 @@ class MessagesBaseTest(base.V2Base):
resp['body']['messages']['ttl'])
def test_post_to_non_ascii_queue(self):
queue_name = u'non-ascii-n\u0153me'
queue_name = 'non-ascii-n\u0153me'
resp = self._post_messages(queue_name)
self.assertEqual(400, resp['headers']['status'])

View File

@ -224,8 +224,8 @@ class QueueLifecycleBaseTest(base.V2Base):
self.protocol.onMessage(req, False)
def test_non_ascii_name(self):
test_params = ((u'/queues/non-ascii-n\u0153me', 'utf-8'),
(u'/queues/non-ascii-n\xc4me', 'iso8859-1'))
test_params = (('/queues/non-ascii-n\u0153me', 'utf-8'),
('/queues/non-ascii-n\xc4me', 'iso8859-1'))
headers = {
'Client-ID': uuidutils.generate_uuid(),

View File

@ -350,7 +350,7 @@ class SubscriptionTest(base.V1_1Base):
ws_notification = msgpack.unpackb(sender.call_args_list[2][0][0])
self.assertEqual({'body': {'status': 'disco queen'}, 'ttl': 60,
'queue_name': 'kitkat',
'Message_Type': u'Notification'}, ws_notification)
'Message_Type': 'Notification'}, ws_notification)
def test_list_returns_503_on_nopoolfound_exception(self):
sub = self.boot.storage.subscription_controller.create(

View File

@ -186,7 +186,7 @@ class TestMessagesMongoDB(base.V1Base):
# embedded queue name params go through the validation
# hook, regardless of the target resource.
path = self.url_prefix + u'/queues/non-ascii-n\u0153me/messages'
path = self.url_prefix + '/queues/non-ascii-n\u0153me/messages'
self._post_messages(path)
self.assertEqual(falcon.HTTP_400, self.srmock.status)

View File

@ -141,8 +141,8 @@ class TestQueueLifecycleMongoDB(base.V1Base):
self.assertEqual(falcon.HTTP_201, self.srmock.status)
def test_non_ascii_name(self):
test_params = ((u'/queues/non-ascii-n\u0153me', 'utf-8'),
(u'/queues/non-ascii-n\xc4me', 'iso8859-1'))
test_params = (('/queues/non-ascii-n\u0153me', 'utf-8'),
('/queues/non-ascii-n\xc4me', 'iso8859-1'))
for uri, enc in test_params:
uri = self.url_prefix + uri

View File

@ -228,7 +228,7 @@ class TestMessagesMongoDB(base.V1_1Base):
# embedded queue name params go through the validation
# hook, regardless of the target resource.
path = self.url_prefix + u'/queues/non-ascii-n\u0153me/messages'
path = self.url_prefix + '/queues/non-ascii-n\u0153me/messages'
self._post_messages(path)
self.assertEqual(falcon.HTTP_400, self.srmock.status)

View File

@ -134,8 +134,8 @@ class TestQueueLifecycleMongoDB(base.V1_1Base):
self.assertEqual(falcon.HTTP_201, self.srmock.status)
def test_non_ascii_name(self):
test_params = ((u'/queues/non-ascii-n\u0153me', 'utf-8'),
(u'/queues/non-ascii-n\xc4me', 'iso8859-1'))
test_params = (('/queues/non-ascii-n\u0153me', 'utf-8'),
('/queues/non-ascii-n\xc4me', 'iso8859-1'))
for uri, enc in test_params:
uri = self.url_prefix + uri

View File

@ -258,7 +258,7 @@ class TestMessagesMongoDB(base.V2Base):
# embedded queue name params go through the validation
# hook, regardless of the target resource.
path = self.url_prefix + u'/queues/non-ascii-n\u0153me/messages'
path = self.url_prefix + '/queues/non-ascii-n\u0153me/messages'
self._post_messages(path)
self.assertEqual(falcon.HTTP_400, self.srmock.status)

View File

@ -209,8 +209,8 @@ class TestQueueLifecycleMongoDB(base.V2Base):
self.assertEqual(falcon.HTTP_201, self.srmock.status)
def test_non_ascii_name(self):
test_params = ((u'/queues/non-ascii-n\u0153me', 'utf-8'),
(u'/queues/non-ascii-n\xc4me', 'iso8859-1'))
test_params = (('/queues/non-ascii-n\u0153me', 'utf-8'),
('/queues/non-ascii-n\xc4me', 'iso8859-1'))
for uri, enc in test_params:
uri = self.url_prefix + uri

View File

@ -201,8 +201,8 @@ class TestTopicLifecycleMongoDB(base.V2Base):
self.assertEqual(falcon.HTTP_201, self.srmock.status)
def test_non_ascii_name(self):
test_params = ((u'/topics/non-ascii-n\u0153me', 'utf-8'),
(u'/topics/non-ascii-n\xc4me', 'iso8859-1'))
test_params = (('/topics/non-ascii-n\u0153me', 'utf-8'),
('/topics/non-ascii-n\xc4me', 'iso8859-1'))
for uri, enc in test_params:
uri = self.url_prefix + uri

View File

@ -203,8 +203,8 @@ class AES256Encryptor(Encryptor):
for msg in messages:
self._encrypt_message(msg)
else:
msg = _(u'Now Zaqar only support AES-256 and need to specify the'
u'key.')
msg = _('Now Zaqar only support AES-256 and need to specify the'
'key.')
raise EncryptionFailed(msg)
@assert_crypto_availability
@ -217,8 +217,8 @@ class AES256Encryptor(Encryptor):
for msg in messages:
self._decrypt_message(msg)
else:
msg = _(u'Now Zaqar only support AES-256 and need to specify the'
u'key.')
msg = _('Now Zaqar only support AES-256 and need to specify the'
'key.')
raise EncryptionFailed(msg)
@ -279,8 +279,8 @@ class RSAEncryptor(Encryptor):
for msg in messages:
self._encrypt_message(msg)
else:
msg = _(u'Now Zaqar only support AES-256 and need to specify the'
u'key.')
msg = _('Now Zaqar only support AES-256 and need to specify the'
'key.')
raise EncryptionFailed(msg)
@assert_crypto_availability

View File

@ -52,7 +52,7 @@ class KeystoneAuth(object):
@classmethod
def install(cls, app, conf):
"""Install Auth check on application."""
LOG.debug(u'Installing Keystone\'s auth protocol')
LOG.debug('Installing Keystone\'s auth protocol')
return auth_token.AuthProtocol(app,
conf={"oslo-config-config": conf,

View File

@ -75,7 +75,7 @@ class CORSMiddleware(object):
@classmethod
def install(cls, app, auth_app, conf):
LOG.debug(u'Installing CORS middleware.')
LOG.debug('Installing CORS middleware.')
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',

View File

@ -110,6 +110,6 @@ def install_wsgi_tracer(app, conf):
enabled = conf.profiler.enabled and conf.profiler.trace_wsgi_transport
if enabled:
LOG.debug(u'Installing osprofiler\'s wsgi tracer')
LOG.debug('Installing osprofiler\'s wsgi tracer')
return ProfileWSGIMiddleware(app, conf.profiler.hmac_keys, enabled=enabled)

View File

@ -67,16 +67,16 @@ class Validator(object):
"""
if project is not None and len(project) > PROJECT_ID_MAX_LEN:
msg = _(u'Project ids may not be more than {0} characters long.')
msg = _('Project ids may not be more than {0} characters long.')
raise ValidationFailed(msg, PROJECT_ID_MAX_LEN)
if len(queue) > QUEUE_NAME_MAX_LEN:
msg = _(u'Queue names may not be more than {0} characters long.')
msg = _('Queue names may not be more than {0} characters long.')
raise ValidationFailed(msg, QUEUE_NAME_MAX_LEN)
if not QUEUE_NAME_REGEX.match(queue):
raise ValidationFailed(
_(u'Queue names may only contain ASCII letters, digits, '
_('Queue names may only contain ASCII letters, digits, '
'underscores, and dashes.'))
def _get_change_operation_d10(self, raw_change):
@ -258,7 +258,7 @@ class Validator(object):
uplimit = self._limits_conf.max_queues_per_page
if limit is not None and not (0 < limit <= uplimit):
msg = _(u'Limit must be at least 1 and no greater than {0}.')
msg = _('Limit must be at least 1 and no greater than {0}.')
raise ValidationFailed(msg, self._limits_conf.max_queues_per_page)
def queue_metadata_length(self, content_length):
@ -270,7 +270,7 @@ class Validator(object):
if content_length is None:
return
if content_length > self._limits_conf.max_queue_metadata:
msg = _(u'Queue metadata is too large. Max size: {0}')
msg = _('Queue metadata is too large. Max size: {0}')
raise ValidationFailed(msg, self._limits_conf.max_queue_metadata)
def queue_metadata_putting(self, queue_metadata):
@ -284,13 +284,13 @@ class Validator(object):
queue_default_ttl = queue_metadata.get('_default_message_ttl')
if queue_default_ttl and not isinstance(queue_default_ttl, int):
msg = _(u'_default_message_ttl must be integer.')
msg = _('_default_message_ttl must be integer.')
raise ValidationFailed(msg)
if queue_default_ttl is not None:
if not (MIN_MESSAGE_TTL <= queue_default_ttl <=
self._limits_conf.max_message_ttl):
msg = _(u'_default_message_ttl can not exceed {0} '
msg = _('_default_message_ttl can not exceed {0} '
'seconds, and must be at least {1} seconds long.')
raise ValidationFailed(
msg, self._limits_conf.max_message_ttl, MIN_MESSAGE_TTL)
@ -298,30 +298,30 @@ class Validator(object):
queue_max_msg_size = queue_metadata.get('_max_messages_post_size',
None)
if queue_max_msg_size and not isinstance(queue_max_msg_size, int):
msg = _(u'_max_messages_post_size must be integer.')
msg = _('_max_messages_post_size must be integer.')
raise ValidationFailed(msg)
if queue_max_msg_size is not None:
if not (0 < queue_max_msg_size <=
self._limits_conf.max_messages_post_size):
raise ValidationFailed(
_(u'_max_messages_post_size can not exceed {0}, '
_('_max_messages_post_size can not exceed {0}, '
' and must be at least greater than 0.'),
self._limits_conf.max_messages_post_size)
max_claim_count = queue_metadata.get('_max_claim_count', None)
if max_claim_count and not isinstance(max_claim_count, int):
msg = _(u'_max_claim_count must be integer.')
msg = _('_max_claim_count must be integer.')
raise ValidationFailed(msg)
dlq_ttl = queue_metadata.get('_dead_letter_queue_messages_ttl', None)
if dlq_ttl and not isinstance(dlq_ttl, int):
msg = _(u'_dead_letter_queue_messages_ttl must be integer.')
msg = _('_dead_letter_queue_messages_ttl must be integer.')
raise ValidationFailed(msg)
if dlq_ttl is not None and not (MIN_MESSAGE_TTL <= dlq_ttl <=
self._limits_conf.max_message_ttl):
msg = _(u'The TTL for a message may not exceed {0} seconds, '
msg = _('The TTL for a message may not exceed {0} seconds, '
'and must be at least {1} seconds long.')
raise ValidationFailed(msg, self._limits_conf.max_message_ttl,
MIN_MESSAGE_TTL)
@ -329,13 +329,13 @@ class Validator(object):
queue_delay = queue_metadata.get('_default_message_delay',
None)
if queue_delay and not isinstance(queue_delay, int):
msg = _(u'_default_message_delay must be integer.')
msg = _('_default_message_delay must be integer.')
raise ValidationFailed(msg)
if queue_delay is not None:
if not (MIN_DELAY_TTL <= queue_delay <=
self._limits_conf.max_message_delay):
msg = _(u'The TTL can not exceed {0} seconds, and must '
msg = _('The TTL can not exceed {0} seconds, and must '
'be at least {1} seconds long.')
raise ValidationFailed(
msg, self._limits_conf.max_message_delay,
@ -343,7 +343,7 @@ class Validator(object):
encrypted_queue = queue_metadata.get('_enable_encrypt_messages', False)
if encrypted_queue and not isinstance(encrypted_queue, bool):
msg = _(u'_enable_encrypt_messages must be boolean.')
msg = _('_enable_encrypt_messages must be boolean.')
raise ValidationFailed(msg)
self._validate_retry_policy(queue_metadata)
@ -356,12 +356,12 @@ class Validator(object):
"""
if 'resource_types' not in document:
msg = _(u'Post body must contain key "resource_types".')
msg = _('Post body must contain key "resource_types".')
raise ValidationFailed(msg)
if (not set(document['resource_types']).issubset(
_PURGBLE_RESOURCE_TYPES)):
msg = _(u'Resource types must be a sub set of {0}.')
msg = _('Resource types must be a sub set of {0}.')
raise ValidationFailed(msg, _PURGBLE_RESOURCE_TYPES)
def message_posting(self, messages):
@ -373,7 +373,7 @@ class Validator(object):
"""
if not messages:
raise ValidationFailed(_(u'No messages to enqueu.'))
raise ValidationFailed(_('No messages to enqueu.'))
for msg in messages:
self.message_content(msg)
@ -393,7 +393,7 @@ class Validator(object):
self._limits_conf.max_messages_post_size)
if content_length > min_max_size:
raise ValidationFailed(
_(u'Message collection size is too large. The max '
_('Message collection size is too large. The max '
'size for current queue is {0}. It is calculated '
'by max size = min(max_messages_post_size_config: '
'{1}, max_messages_post_size_queue: {2}).'),
@ -408,7 +408,7 @@ class Validator(object):
if content_length > self._limits_conf.max_messages_post_size:
raise ValidationFailed(
_(u'Message collection size is too large. Max size {0}'),
_('Message collection size is too large. Max size {0}'),
self._limits_conf.max_messages_post_size)
def message_content(self, message):
@ -417,7 +417,7 @@ class Validator(object):
ttl = message['ttl']
if not (MIN_MESSAGE_TTL <= ttl <= self._limits_conf.max_message_ttl):
msg = _(u'The TTL for a message may not exceed {0} seconds, and '
msg = _('The TTL for a message may not exceed {0} seconds, and '
'must be at least {1} seconds long.')
raise ValidationFailed(
@ -427,7 +427,7 @@ class Validator(object):
if not (MIN_DELAY_TTL <= delay <=
self._limits_conf.max_message_delay):
msg = _(u'The Delay TTL for a message may not exceed {0} seconds,'
msg = _('The Delay TTL for a message may not exceed {0} seconds,'
'and must be at least {1} seconds long.')
raise ValidationFailed(
@ -444,7 +444,7 @@ class Validator(object):
uplimit = self._limits_conf.max_messages_per_page
if limit is not None and not (0 < limit <= uplimit):
msg = _(u'Limit must be at least 1 and may not '
msg = _('Limit must be at least 1 and may not '
'be greater than {0}.')
raise ValidationFailed(
@ -463,34 +463,34 @@ class Validator(object):
"""
if pop is not None and ids is not None:
msg = _(u'pop and id params cannot be present together in the '
msg = _('pop and id params cannot be present together in the '
'delete request.')
raise ValidationFailed(msg)
if pop is None and ids is None:
msg = _(u'The request should have either "ids" or "pop" '
msg = _('The request should have either "ids" or "pop" '
'parameter in the request, to be able to delete.')
raise ValidationFailed(msg)
if self._limits_conf.message_delete_with_claim_id:
if (ids and claim_ids is None) or (ids is None and claim_ids):
msg = _(u'The request should have both "ids" and "claim_ids" '
msg = _('The request should have both "ids" and "claim_ids" '
'parameter in the request when '
'message_delete_with_claim_id is True.')
raise ValidationFailed(msg)
pop_uplimit = self._limits_conf.max_messages_per_claim_or_pop
if pop is not None and not (0 < pop <= pop_uplimit):
msg = _(u'Pop value must be at least 1 and may not '
msg = _('Pop value must be at least 1 and may not '
'be greater than {0}.')
raise ValidationFailed(msg, pop_uplimit)
delete_uplimit = self._limits_conf.max_messages_per_page
if ids is not None and not (0 < len(ids) <= delete_uplimit):
msg = _(u'ids parameter should have at least 1 and not '
msg = _('ids parameter should have at least 1 and not '
'greater than {0} values.')
raise ValidationFailed(msg, delete_uplimit)
@ -508,7 +508,7 @@ class Validator(object):
uplimit = self._limits_conf.max_messages_per_claim_or_pop
if limit is not None and not (0 < limit <= uplimit):
msg = _(u'Limit must be at least 1 and may not '
msg = _('Limit must be at least 1 and may not '
'be greater than {0}.')
raise ValidationFailed(
@ -517,7 +517,7 @@ class Validator(object):
grace = metadata['grace']
if not (MIN_CLAIM_GRACE <= grace <= self._limits_conf.max_claim_grace):
msg = _(u'The grace for a claim may not exceed {0} seconds, and '
msg = _('The grace for a claim may not exceed {0} seconds, and '
'must be at least {1} seconds long.')
raise ValidationFailed(
@ -533,7 +533,7 @@ class Validator(object):
ttl = metadata['ttl']
if not (MIN_CLAIM_TTL <= ttl <= self._limits_conf.max_claim_ttl):
msg = _(u'The TTL for a claim may not exceed {0} seconds, and '
msg = _('The TTL for a claim may not exceed {0} seconds, and '
'must be at least {1} seconds long.')
raise ValidationFailed(
@ -547,7 +547,7 @@ class Validator(object):
"""
for p in ('subscriber',):
if p not in subscription.keys():
raise ValidationFailed(_(u'Missing parameter %s in body.') % p)
raise ValidationFailed(_('Missing parameter %s in body.') % p)
self.subscription_patching(subscription)
@ -559,7 +559,7 @@ class Validator(object):
"""
if not subscription:
raise ValidationFailed(_(u'No subscription to create.'))
raise ValidationFailed(_('No subscription to create.'))
if not isinstance(subscription, dict):
msg = _('Subscriptions must be a dict.')
@ -573,13 +573,13 @@ class Validator(object):
subscriber_type = parsed_uri.scheme
if subscriber_type not in self._limits_conf.subscriber_types:
msg = _(u'The subscriber type of subscription must be '
u'supported in the list {0}.')
msg = _('The subscriber type of subscription must be '
'supported in the list {0}.')
raise ValidationFailed(msg, self._limits_conf.subscriber_types)
options = subscription.get('options')
if options and not isinstance(options, dict):
msg = _(u'Options must be a dict.')
msg = _('Options must be a dict.')
raise ValidationFailed(msg)
self._validate_retry_policy(options)
@ -587,11 +587,11 @@ class Validator(object):
ttl = subscription.get('ttl')
if ttl:
if not isinstance(ttl, int):
msg = _(u'TTL must be an integer.')
msg = _('TTL must be an integer.')
raise ValidationFailed(msg)
if ttl < MIN_SUBSCRIPTION_TTL:
msg = _(u'The TTL for a subscription '
msg = _('The TTL for a subscription '
'must be at least {0} seconds long.')
raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)
@ -600,7 +600,7 @@ class Validator(object):
now = timeutils.utcnow_ts()
now_dt = datetime.datetime.fromtimestamp(
now, tz=datetime.timezone.utc).replace(tzinfo=None)
msg = _(u'The TTL seconds for a subscription plus current time'
msg = _('The TTL seconds for a subscription plus current time'
' must be less than {0}.')
try:
# NOTE(flwang): If below expression works, then we believe the
@ -626,7 +626,7 @@ class Validator(object):
uplimit = self._limits_conf.max_subscriptions_per_page
if limit is not None and not (0 < limit <= uplimit):
msg = _(u'Limit must be at least 1 and may not '
msg = _('Limit must be at least 1 and may not '
'be greater than {0}.')
raise ValidationFailed(
@ -649,7 +649,7 @@ class Validator(object):
uplimit = self._limits_conf.max_flavors_per_page
if limit is not None and not (0 < limit <= uplimit):
msg = _(u'Limit must be at least 1 and no greater than {0}.')
msg = _('Limit must be at least 1 and no greater than {0}.')
raise ValidationFailed(msg, self._limits_conf.max_flavors_per_page)
def pool_listing(self, limit=None, **kwargs):
@ -662,7 +662,7 @@ class Validator(object):
uplimit = self._limits_conf.max_pools_per_page
if limit is not None and not (0 < limit <= uplimit):
msg = _(u'Limit must be at least 1 and no greater than {0}.')
msg = _('Limit must be at least 1 and no greater than {0}.')
raise ValidationFailed(msg, self._limits_conf.max_pools_per_page)
def client_id_uuid_safe(self, client_id):
@ -675,7 +675,7 @@ class Validator(object):
if self._limits_conf.client_id_uuid_safe == 'off':
if (len(client_id) < self._limits_conf.min_length_client_id) or \
(len(client_id) > self._limits_conf.max_length_client_id):
msg = _(u'Length of client id must be at least {0} and no '
msg = _('Length of client id must be at least {0} and no '
'greater than {1}.')
raise ValidationFailed(msg,
self._limits_conf.min_length_client_id,
@ -695,14 +695,14 @@ class Validator(object):
"""
if project is not None and len(project) > PROJECT_ID_MAX_LEN:
msg = _(u'Project ids may not be more than {0} characters long.')
msg = _('Project ids may not be more than {0} characters long.')
raise ValidationFailed(msg, PROJECT_ID_MAX_LEN)
if len(topic) > QUEUE_NAME_MAX_LEN:
msg = _(u'Topic names may not be more than {0} characters long.')
msg = _('Topic names may not be more than {0} characters long.')
raise ValidationFailed(msg, QUEUE_NAME_MAX_LEN)
if not QUEUE_NAME_REGEX.match(topic):
raise ValidationFailed(
_(u'Topic names may only contain ASCII letters, digits, '
_('Topic names may only contain ASCII letters, digits, '
'underscores, and dashes.'))

View File

@ -71,7 +71,7 @@ class Driver(base.DriverBase):
websocket config group, and the notifiton endpoint using the
'notification_bind' and 'notification_port' options.
"""
msgtmpl = _(u'Serving on host %(bind)s:%(port)s')
msgtmpl = _('Serving on host %(bind)s:%(port)s')
LOG.info(msgtmpl,
{'bind': self._ws_conf.bind, 'port': self._ws_conf.port})

View File

@ -166,7 +166,7 @@ class MessagingProtocol(websocket.WebSocketServerProtocol):
def _deauthenticate(self):
self._authentified = False
self._auth_env = None
self.sendClose(4003, u'Authentication expired.')
self.sendClose(4003, 'Authentication expired.')
def _auth_response(self, status, message):
code = int(status.split()[0])

View File

@ -189,7 +189,7 @@ class Driver(transport.DriverBase):
def listen(self):
"""Self-host using 'bind' and 'port' from the WSGI config group."""
msgtmpl = _(u'Serving on host %(bind)s:%(port)s')
msgtmpl = _('Serving on host %(bind)s:%(port)s')
LOG.info(msgtmpl,
{'bind': self._wsgi_conf.bind, 'port': self._wsgi_conf.port})
server_cls = self._get_server_cls(self._wsgi_conf.bind)

View File

@ -49,7 +49,7 @@ def deserialize(stream, len):
"""
if len is None:
description = _(u'Request body can not be empty')
description = _('Request body can not be empty')
raise errors.HTTPBadRequestBody(description)
try:
@ -60,17 +60,17 @@ def deserialize(stream, len):
except utils.MalformedJSON as ex:
LOG.debug(ex)
description = _(u'Request body could not be parsed.')
description = _('Request body could not be parsed.')
raise errors.HTTPBadRequestBody(description)
except utils.OverflowedJSONInteger as ex:
LOG.debug(ex)
description = _(u'JSON contains integer that is too large.')
description = _('JSON contains integer that is too large.')
raise errors.HTTPBadRequestBody(description)
except Exception:
# Error while reading from the network/server
description = _(u'Request body could not be read.')
description = _('Request body could not be read.')
LOG.exception(description)
raise errors.HTTPServiceUnavailable(description)
@ -167,7 +167,7 @@ def get_checked_field(document, name, value_type, default_value):
if default_value is not None:
value = default_value
else:
description = _(u'Missing "{name}" field.').format(name=name)
description = _('Missing "{name}" field.').format(name=name)
raise errors.HTTPBadRequestBody(description)
# PERF(kgriffs): We do our own little spec thing because it is way
@ -175,7 +175,7 @@ def get_checked_field(document, name, value_type, default_value):
if value_type == '*' or isinstance(value, value_type):
return value
description = _(u'The value of the "{name}" field must be a {vtype}.')
description = _('The value of the "{name}" field must be a {vtype}.')
description = description.format(name=name, vtype=value_type.__name__)
raise errors.HTTPBadRequestBody(description)

View File

@ -70,7 +70,7 @@ class CollectionResource(Resource):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Claim could not be created.')
description = _('Claim could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -111,7 +111,7 @@ class ItemResource(Resource):
LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Claim could not be queried.')
description = _('Claim could not be queried.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -153,7 +153,7 @@ class ItemResource(Resource):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Claim could not be updated.')
description = _('Claim could not be updated.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -167,6 +167,6 @@ class ItemResource(Resource):
resp.status = falcon.HTTP_204
except Exception:
description = _(u'Claim could not be deleted.')
description = _('Claim could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -57,7 +57,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Message could not be retrieved.')
description = _('Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -100,7 +100,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Messages could not be listed.')
description = _('Messages could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -161,12 +161,12 @@ class CollectionResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except storage_errors.MessageConflict:
description = _(u'No messages could be enqueued.')
description = _('No messages could be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
except Exception:
description = _(u'Messages could not be enqueued.')
description = _('Messages could not be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -222,7 +222,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Messages could not be deleted.')
description = _('Messages could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -249,7 +249,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Message could not be retrieved.')
description = _('Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -261,7 +261,7 @@ class ItemResource(object):
@decorators.TransportLog("Messages item")
def on_delete(self, req, resp, project_id, queue_name, message_id):
error_title = _(u'Unable to delete')
error_title = _('Unable to delete')
try:
self._message_controller.delete(
@ -272,27 +272,27 @@ class ItemResource(object):
except storage_errors.MessageNotClaimed as ex:
LOG.debug(ex)
description = _(u'A claim was specified, but the message '
u'is not currently claimed.')
description = _('A claim was specified, but the message '
'is not currently claimed.')
raise falcon.HTTPBadRequest(
title=error_title, description=description)
except storage_errors.ClaimDoesNotExist as ex:
LOG.debug(ex)
description = _(u'The specified claim does not exist or '
u'has expired.')
description = _('The specified claim does not exist or '
'has expired.')
raise falcon.HTTPBadRequest(
title=error_title, description=description)
except storage_errors.NotPermitted as ex:
LOG.debug(ex)
description = _(u'This message is claimed; it cannot be '
u'deleted without a valid claim ID.')
description = _('This message is claimed; it cannot be '
'deleted without a valid claim ID.')
raise falcon.HTTPForbidden(
title=error_title, description=description)
except Exception:
description = _(u'Message could not be deleted.')
description = _('Message could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -47,7 +47,7 @@ class Resource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Queue metadata could not be retrieved.')
description = _('Queue metadata could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -66,9 +66,9 @@ class Resource(object):
# Restrict setting any reserved queue attributes
for key in metadata:
if key.startswith('_'):
description = _(u'Reserved queue attributes in metadata '
u'(which names start with "_") can not be '
u'set in API v1.')
description = _('Reserved queue attributes in metadata '
'(which names start with "_") can not be '
'set in API v1.')
raise validation.ValidationFailed(description)
except validation.ValidationFailed as ex:
LOG.debug(ex)
@ -87,7 +87,7 @@ class Resource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Metadata could not be updated.')
description = _('Metadata could not be updated.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -77,7 +77,7 @@ class Listing(object):
:returns: HTTP | 200
"""
LOG.debug(u'LIST pools')
LOG.debug('LIST pools')
store = {}
request.get_param('marker', store=store)
@ -134,7 +134,7 @@ class Resource(object):
:returns: HTTP | [200, 404]
"""
LOG.debug(u'GET pool - name: %s', pool)
LOG.debug('GET pool - name: %s', pool)
data = None
detailed = request.get_param_as_bool('detailed') or False
@ -162,7 +162,7 @@ class Resource(object):
:returns: HTTP | [201, 204]
"""
LOG.debug(u'PUT pool - name: %s', pool)
LOG.debug('PUT pool - name: %s', pool)
conf = self._ctrl.driver.conf
data = wsgi_utils.load(request)
@ -187,7 +187,7 @@ class Resource(object):
:returns: HTTP | 204
"""
LOG.debug(u'DELETE pool - name: %s', pool)
LOG.debug('DELETE pool - name: %s', pool)
self._ctrl.delete(pool)
response.status = falcon.HTTP_204
@ -204,12 +204,12 @@ class Resource(object):
:returns: HTTP | 200,400
"""
LOG.debug(u'PATCH pool - name: %s', pool)
LOG.debug('PATCH pool - name: %s', pool)
data = wsgi_utils.load(request)
EXPECT = ('weight', 'uri', 'options')
if not any([(field in data) for field in EXPECT]):
LOG.debug(u'PATCH pool, bad params')
LOG.debug('PATCH pool, bad params')
raise wsgi_errors.HTTPBadRequestBody(
'One of `uri`, `weight`, or `options` needs '
'to be specified'

View File

@ -41,7 +41,7 @@ class ItemResource(object):
queue_name, project=project_id)
except Exception:
description = _(u'Queue could not be created.')
description = _('Queue could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -65,7 +65,7 @@ class ItemResource(object):
self._queue_controller.delete(queue_name, project=project_id)
except Exception:
description = _(u'Queue could not be deleted.')
description = _('Queue could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -81,7 +81,7 @@ class CollectionResource(object):
self._validate = validate
def on_get(self, req, resp, project_id):
LOG.debug(u'Queue collection GET')
LOG.debug('Queue collection GET')
kwargs = {}
@ -103,7 +103,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Queues could not be listed.')
description = _('Queues could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -67,6 +67,6 @@ class Resource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Queue stats could not be read.')
description = _('Queue stats could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -90,7 +90,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Claim could not be created.')
description = _('Claim could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -138,7 +138,7 @@ class ItemResource(object):
LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Claim could not be queried.')
description = _('Claim could not be queried.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -180,7 +180,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Claim could not be updated.')
description = _('Claim could not be updated.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -194,6 +194,6 @@ class ItemResource(object):
resp.status = falcon.HTTP_204
except Exception:
description = _(u'Claim could not be deleted.')
description = _('Claim could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -56,7 +56,7 @@ class Listing(object):
:returns: HTTP | 200
"""
LOG.debug(u'LIST flavors for project_id %s', project_id)
LOG.debug('LIST flavors for project_id %s', project_id)
store = {}
request.get_param('marker', store=store)
@ -111,7 +111,7 @@ class Resource(object):
:returns: HTTP | [200, 404]
"""
LOG.debug(u'GET flavor - name: %s', flavor)
LOG.debug('GET flavor - name: %s', flavor)
data = None
detailed = request.get_param_as_bool('detailed') or False
@ -139,7 +139,7 @@ class Resource(object):
:returns: HTTP | [201, 400]
"""
LOG.debug(u'PUT flavor - name: %s', flavor)
LOG.debug('PUT flavor - name: %s', flavor)
data = wsgi_utils.load(request)
wsgi_utils.validate(self._validators['create'], data)
@ -150,7 +150,7 @@ class Resource(object):
response.status = falcon.HTTP_201
response.location = request.path
except errors.PoolGroupDoesNotExist:
description = (_(u'Flavor %(flavor)s could not be created. ') %
description = (_('Flavor %(flavor)s could not be created. ') %
dict(flavor=flavor))
LOG.exception(description)
raise falcon.HTTPBadRequest(
@ -162,7 +162,7 @@ class Resource(object):
:returns: HTTP | [204]
"""
LOG.debug(u'DELETE flavor - name: %s', flavor)
LOG.debug('DELETE flavor - name: %s', flavor)
self._ctrl.delete(flavor, project=project_id)
response.status = falcon.HTTP_204
@ -179,12 +179,12 @@ class Resource(object):
:returns: HTTP | [200, 400]
"""
LOG.debug(u'PATCH flavor - name: %s', flavor)
LOG.debug('PATCH flavor - name: %s', flavor)
data = wsgi_utils.load(request)
EXPECT = ('capabilities')
if not any([(field in data) for field in EXPECT]):
LOG.debug(u'PATCH flavor, bad params')
LOG.debug('PATCH flavor, bad params')
raise wsgi_errors.HTTPBadRequestBody(
'`capabilities` needs '
'to be specified'

View File

@ -34,6 +34,6 @@ class Resource(object):
resp_dict = self._driver.health()
resp.text = utils.to_json(resp_dict)
except Exception:
description = _(u'Health status could not be read.')
description = _('Health status could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -70,7 +70,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Message could not be retrieved.')
description = _('Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -116,7 +116,7 @@ class CollectionResource(object):
messages = None
except Exception:
description = _(u'Messages could not be listed.')
description = _('Messages could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -164,7 +164,7 @@ class CollectionResource(object):
document = wsgi_utils.deserialize(req.stream, req.content_length)
if 'messages' not in document:
description = _(u'No messages were found in the request body.')
description = _('No messages were found in the request body.')
raise wsgi_errors.HTTPBadRequestAPI(description)
messages = wsgi_utils.sanitize(document['messages'],
@ -192,12 +192,12 @@ class CollectionResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except storage_errors.MessageConflict:
description = _(u'No messages could be enqueued.')
description = _('No messages could be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
except Exception:
description = _(u'Messages could not be enqueued.')
description = _('Messages could not be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -225,8 +225,8 @@ class CollectionResource(object):
# NOTE(TheSriram): Trying to get a message by id, should
# return the message if its present, otherwise a 404 since
# the message might have been deleted.
msg = _(u'No messages with IDs: {ids} found in the queue {queue} '
u'for project {project}.')
msg = _('No messages with IDs: {ids} found in the queue {queue} '
'for project {project}.')
description = msg.format(queue=queue_name, project=project_id,
ids=ids)
raise wsgi_errors.HTTPNotFound(description)
@ -263,7 +263,7 @@ class CollectionResource(object):
project=project_id)
except Exception:
description = _(u'Messages could not be deleted.')
description = _('Messages could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -271,8 +271,8 @@ class CollectionResource(object):
def _pop_messages(self, queue_name, project_id, pop_limit):
try:
LOG.debug(u'POP messages - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('POP messages - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
messages = self._message_controller.pop(
@ -281,7 +281,7 @@ class CollectionResource(object):
limit=pop_limit)
except Exception:
description = _(u'Messages could not be popped.')
description = _('Messages could not be popped.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -314,7 +314,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Message could not be retrieved.')
description = _('Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -329,7 +329,7 @@ class ItemResource(object):
@decorators.TransportLog("Messages item")
def on_delete(self, req, resp, project_id, queue_name, message_id):
error_title = _(u'Unable to delete')
error_title = _('Unable to delete')
try:
self._message_controller.delete(
@ -340,27 +340,27 @@ class ItemResource(object):
except storage_errors.MessageNotClaimed as ex:
LOG.debug(ex)
description = _(u'A claim was specified, but the message '
u'is not currently claimed.')
description = _('A claim was specified, but the message '
'is not currently claimed.')
raise falcon.HTTPBadRequest(
title=error_title, description=description)
except storage_errors.ClaimDoesNotExist as ex:
LOG.debug(ex)
description = _(u'The specified claim does not exist or '
u'has expired.')
description = _('The specified claim does not exist or '
'has expired.')
raise falcon.HTTPBadRequest(
title=error_title, description=description)
except storage_errors.NotPermitted as ex:
LOG.debug(ex)
description = _(u'This message is claimed; it cannot be '
u'deleted without a valid claim ID.')
description = _('This message is claimed; it cannot be '
'deleted without a valid claim ID.')
raise falcon.HTTPForbidden(
title=error_title, description=description)
except Exception:
description = _(u'Message could not be deleted.')
description = _('Message could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -79,7 +79,7 @@ class Listing(object):
:returns: HTTP | 200
"""
LOG.debug(u'LIST pools')
LOG.debug('LIST pools')
store = {}
request.get_param('marker', store=store)
@ -138,7 +138,7 @@ class Resource(object):
:returns: HTTP | [200, 404]
"""
LOG.debug(u'GET pool - name: %s', pool)
LOG.debug('GET pool - name: %s', pool)
data = None
detailed = request.get_param_as_bool('detailed') or False
@ -165,7 +165,7 @@ class Resource(object):
:returns: HTTP | [201, 204]
"""
LOG.debug(u'PUT pool - name: %s', pool)
LOG.debug('PUT pool - name: %s', pool)
conf = self._ctrl.driver.conf
data = wsgi_utils.load(request)
@ -181,7 +181,7 @@ class Resource(object):
response.status = falcon.HTTP_201
response.location = request.path
except errors.PoolCapabilitiesMismatch as e:
title = _(u'Unable to create pool')
title = _('Unable to create pool')
LOG.exception(title)
raise falcon.HTTPBadRequest(title=title, description=str(e))
except errors.PoolAlreadyExists as e:
@ -194,14 +194,14 @@ class Resource(object):
:returns: HTTP | [204, 403]
"""
LOG.debug(u'DELETE pool - name: %s', pool)
LOG.debug('DELETE pool - name: %s', pool)
try:
self._ctrl.delete(pool)
except errors.PoolInUseByFlavor as ex:
title = _(u'Unable to delete')
description = _(u'This pool is used by flavors {flavor}; '
u'It cannot be deleted.')
title = _('Unable to delete')
description = _('This pool is used by flavors {flavor}; '
'It cannot be deleted.')
description = description.format(flavor=ex.flavor)
LOG.exception(description)
raise falcon.HTTPForbidden(title=title, description=description)
@ -221,12 +221,12 @@ class Resource(object):
:returns: HTTP | 200,400
"""
LOG.debug(u'PATCH pool - name: %s', pool)
LOG.debug('PATCH pool - name: %s', pool)
data = wsgi_utils.load(request)
EXPECT = ('weight', 'uri', 'options')
if not any([(field in data) for field in EXPECT]):
LOG.debug(u'PATCH pool, bad params')
LOG.debug('PATCH pool, bad params')
raise wsgi_errors.HTTPBadRequestBody(
'One of `uri`, `weight`,or `options` needs '
'to be specified'

View File

@ -48,7 +48,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Queue metadata could not be retrieved.')
description = _('Queue metadata could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -84,7 +84,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Queue could not be created.')
description = _('Queue could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -97,7 +97,7 @@ class ItemResource(object):
self._queue_controller.delete(queue_name, project=project_id)
except Exception:
description = _(u'Queue could not be deleted.')
description = _('Queue could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -134,7 +134,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Queues could not be listed.')
description = _('Queues could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -68,6 +68,6 @@ class Resource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Queue stats could not be read.')
description = _('Queue stats could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -92,7 +92,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Claim could not be created.')
description = _('Claim could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -141,7 +141,7 @@ class ItemResource(object):
LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Claim could not be queried.')
description = _('Claim could not be queried.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -184,7 +184,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Claim could not be updated.')
description = _('Claim could not be updated.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -199,6 +199,6 @@ class ItemResource(object):
resp.status = falcon.HTTP_204
except Exception:
description = _(u'Claim could not be deleted.')
description = _('Claim could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -63,7 +63,7 @@ class Listing(object):
:returns: HTTP | 200
"""
LOG.debug(u'LIST flavors for project_id %s', project_id)
LOG.debug('LIST flavors for project_id %s', project_id)
store = {}
request.get_param('marker', store=store)
request.get_param_as_int('limit', store=store)
@ -142,7 +142,7 @@ class Resource(object):
:returns: HTTP | [200, 404]
"""
LOG.debug(u'GET flavor - name: %s', flavor)
LOG.debug('GET flavor - name: %s', flavor)
data = None
try:
@ -188,7 +188,7 @@ class Resource(object):
def _on_put_by_pool_list(self, request, response, project_id,
flavor, pool_list):
LOG.debug(u'PUT flavor - name by flavor: %s', flavor)
LOG.debug('PUT flavor - name by flavor: %s', flavor)
# NOTE(gengchc2): If configuration flavor is used by the new schema,
# a list of pools is required.
if len(pool_list) == 0:
@ -200,7 +200,7 @@ class Resource(object):
try:
self._check_pools_exists(pool_list)
except errors.PoolDoesNotExist as ex:
description = (_(u'Flavor %(flavor)s could not be created, '
description = (_('Flavor %(flavor)s could not be created, '
'error:%(msg)s') %
dict(flavor=flavor, msg=str(ex)))
LOG.exception(description)
@ -214,7 +214,7 @@ class Resource(object):
response.status = falcon.HTTP_201
response.location = request.path
except errors.ConnectionError as ex:
description = (_(u'Flavor %(flavor)s could not be created, '
description = (_('Flavor %(flavor)s could not be created, '
'error:%(msg)s') %
dict(flavor=flavor, msg=str(ex)))
LOG.exception(description)
@ -224,7 +224,7 @@ class Resource(object):
try:
self._update_pools_by_flavor(flavor, pool_list)
except errors.ConnectionError as ex:
description = (_(u'Flavor %(flavor)s could not be created, '
description = (_('Flavor %(flavor)s could not be created, '
'error:%(msg)s') %
dict(flavor=flavor, msg=str(ex)))
LOG.exception(description)
@ -245,7 +245,7 @@ class Resource(object):
:returns: HTTP | [201, 400]
"""
LOG.debug(u'PUT flavor - name: %s', flavor)
LOG.debug('PUT flavor - name: %s', flavor)
data = wsgi_utils.load(request)
wsgi_utils.validate(self._validators['create'], data)
@ -262,14 +262,14 @@ class Resource(object):
:returns: HTTP | [204]
"""
LOG.debug(u'DELETE flavor - name: %s', flavor)
LOG.debug('DELETE flavor - name: %s', flavor)
# NOTE(gengchc2): If configuration flavor is
# used by the new schema, the flavor field in pools
# need to be cleaned.
try:
self._clean_pools_by_flavor(flavor)
except errors.ConnectionError:
description = (_(u'Flavor %(flavor)s could not be deleted.') %
description = (_('Flavor %(flavor)s could not be deleted.') %
dict(flavor=flavor))
LOG.exception(description)
raise falcon.HTTPBadRequest(
@ -301,7 +301,7 @@ class Resource(object):
try:
self._check_pools_exists(pool_list)
except errors.PoolDoesNotExist as ex:
description = (_(u'Flavor %(flavor)s cant be updated, '
description = (_('Flavor %(flavor)s cant be updated, '
'error:%(msg)s') %
dict(flavor=flavor, msg=str(ex)))
LOG.exception(description)
@ -321,7 +321,7 @@ class Resource(object):
try:
self._update_pools_by_flavor(flavor, pool_list)
except errors.ConnectionError as ex:
description = (_(u'Flavor %(flavor)s could not be updated, '
description = (_('Flavor %(flavor)s could not be updated, '
'error:%(msg)s') %
dict(flavor=flavor, msg=str(ex)))
LOG.exception(description)
@ -335,7 +335,7 @@ class Resource(object):
pool_list_removed.append(pool_old['name'])
self._clean_pools_by_flavor(flavor, pool_list_removed)
except errors.ConnectionError as ex:
description = (_(u'Flavor %(flavor)s could not be updated, '
description = (_('Flavor %(flavor)s could not be updated, '
'error:%(msg)s') %
dict(flavor=flavor, msg=str(ex)))
LOG.exception(description)
@ -358,11 +358,11 @@ class Resource(object):
:returns: HTTP | [200, 400]
"""
LOG.debug(u'PATCH flavor - name: %s', flavor)
LOG.debug('PATCH flavor - name: %s', flavor)
data = wsgi_utils.load(request)
field = 'pool_list'
if field not in data:
LOG.debug(u'PATCH flavor, bad params')
LOG.debug('PATCH flavor, bad params')
raise wsgi_errors.HTTPBadRequestBody(
'`pool_list` needs to be specified'
)

View File

@ -38,6 +38,6 @@ class Resource(object):
resp_dict = self._driver.health()
resp.text = utils.to_json(resp_dict)
except Exception:
description = _(u'Health status could not be read.')
description = _('Health status could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -73,7 +73,7 @@ class CollectionResource(object):
LOG.exception('Queue name "%s" does not exist', queue_name)
queue_meta = None
except Exception:
description = _(u'Message could not be retrieved.')
description = _('Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -145,7 +145,7 @@ class CollectionResource(object):
messages = None
except Exception:
description = _(u'Messages could not be listed.')
description = _('Messages could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -221,7 +221,7 @@ class CollectionResource(object):
document = wsgi_utils.deserialize(req.stream, req.content_length)
if 'messages' not in document:
description = _(u'No messages were found in the request body.')
description = _('No messages were found in the request body.')
raise wsgi_errors.HTTPBadRequestAPI(description)
messages = wsgi_utils.sanitize(document['messages'],
@ -249,12 +249,12 @@ class CollectionResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except storage_errors.MessageConflict:
description = _(u'No messages could be enqueued.')
description = _('No messages could be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
except Exception:
description = _(u'Messages could not be enqueued.')
description = _('Messages could not be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -283,8 +283,8 @@ class CollectionResource(object):
# NOTE(TheSriram): Trying to get a message by id, should
# return the message if its present, otherwise a 404 since
# the message might have been deleted.
msg = _(u'No messages with IDs: {ids} found in the queue {queue} '
u'for project {project}.')
msg = _('No messages with IDs: {ids} found in the queue {queue} '
'for project {project}.')
description = msg.format(queue=queue_name, project=project_id,
ids=ids)
raise wsgi_errors.HTTPNotFound(description)
@ -327,7 +327,7 @@ class CollectionResource(object):
claim_ids=claim_ids)
except Exception:
description = _(u'Messages could not be deleted.')
description = _('Messages could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -335,8 +335,8 @@ class CollectionResource(object):
def _pop_messages(self, queue_name, project_id, pop_limit):
try:
LOG.debug(u'POP messages - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('POP messages - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
messages = self._message_controller.pop(
@ -345,7 +345,7 @@ class CollectionResource(object):
limit=pop_limit)
except Exception:
description = _(u'Messages could not be popped.')
description = _('Messages could not be popped.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -392,7 +392,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Message could not be retrieved.')
description = _('Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -408,7 +408,7 @@ class ItemResource(object):
@decorators.TransportLog("Messages item")
@acl.enforce("messages:delete")
def on_delete(self, req, resp, project_id, queue_name, message_id):
error_title = _(u'Unable to delete')
error_title = _('Unable to delete')
try:
self._message_controller.delete(
@ -419,27 +419,27 @@ class ItemResource(object):
except storage_errors.MessageNotClaimed as ex:
LOG.debug(ex)
description = _(u'A claim was specified, but the message '
u'is not currently claimed.')
description = _('A claim was specified, but the message '
'is not currently claimed.')
raise falcon.HTTPBadRequest(
title=error_title, description=description)
except storage_errors.ClaimDoesNotExist as ex:
LOG.debug(ex)
description = _(u'The specified claim does not exist or '
u'has expired.')
description = _('The specified claim does not exist or '
'has expired.')
raise falcon.HTTPBadRequest(
title=error_title, description=description)
except storage_errors.NotPermitted as ex:
LOG.debug(ex)
description = _(u'This message is claimed; it cannot be '
u'deleted without a valid claim ID.')
description = _('This message is claimed; it cannot be '
'deleted without a valid claim ID.')
raise falcon.HTTPForbidden(
title=error_title, description=description)
except Exception:
description = _(u'Message could not be deleted.')
description = _('Message could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -85,7 +85,7 @@ class Listing(object):
:returns: HTTP | 200
"""
LOG.debug(u'LIST pools')
LOG.debug('LIST pools')
store = {}
request.get_param('marker', store=store)
@ -152,7 +152,7 @@ class Resource(object):
:returns: HTTP | [200, 404]
"""
LOG.debug(u'GET pool - name: %s', pool)
LOG.debug('GET pool - name: %s', pool)
data = None
detailed = request.get_param_as_bool('detailed') or False
@ -181,7 +181,7 @@ class Resource(object):
:returns: HTTP | [201, 204]
"""
LOG.debug(u'PUT pool - name: %s', pool)
LOG.debug('PUT pool - name: %s', pool)
conf = self._ctrl.driver.conf
data = wsgi_utils.load(request)
@ -198,7 +198,7 @@ class Resource(object):
response.status = falcon.HTTP_201
response.location = request.path
except errors.PoolCapabilitiesMismatch as e:
title = _(u'Unable to create pool')
title = _('Unable to create pool')
LOG.exception(title)
raise falcon.HTTPBadRequest(title=title, description=str(e))
except errors.PoolAlreadyExists as e:
@ -213,14 +213,14 @@ class Resource(object):
:returns: HTTP | [204, 403]
"""
LOG.debug(u'DELETE pool - name: %s', pool)
LOG.debug('DELETE pool - name: %s', pool)
try:
self._ctrl.delete(pool)
except errors.PoolInUseByFlavor as ex:
title = _(u'Unable to delete')
description = _(u'This pool is used by flavors {flavor}; '
u'It cannot be deleted.')
title = _('Unable to delete')
description = _('This pool is used by flavors {flavor}; '
'It cannot be deleted.')
description = description.format(flavor=ex.flavor)
LOG.exception(description)
raise falcon.HTTPForbidden(title=title, description=description)
@ -242,12 +242,12 @@ class Resource(object):
:returns: HTTP | 200,400
"""
LOG.debug(u'PATCH pool - name: %s', pool)
LOG.debug('PATCH pool - name: %s', pool)
data = wsgi_utils.load(request)
EXPECT = ('weight', 'uri', 'flavor', 'options')
if not any([(field in data) for field in EXPECT]):
LOG.debug(u'PATCH pool, bad params')
LOG.debug('PATCH pool, bad params')
raise wsgi_errors.HTTPBadRequestBody(
'One of `uri`, `weight`, `flavor`,'
' or `options` needs '

View File

@ -75,7 +75,7 @@ class Resource(object):
except ValueError as err:
raise wsgi_errors.HTTPBadRequestAPI(str(err))
except Exception:
description = _(u'Queue could not be purged.')
description = _('Queue could not be purged.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -69,7 +69,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Queue metadata could not be retrieved.')
description = _('Queue metadata could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -102,7 +102,7 @@ class ItemResource(object):
LOG.exception('Flavor "%s" does not exist', queue_name)
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Queue could not be created.')
description = _('Queue could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -112,14 +112,14 @@ class ItemResource(object):
@decorators.TransportLog("Queues item")
@acl.enforce("queues:delete")
def on_delete(self, req, resp, project_id, queue_name):
LOG.debug(u'Queue item DELETE - queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Queue item DELETE - queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try:
self._queue_controller.delete(queue_name, project=project_id)
except Exception:
description = _(u'Queue could not be deleted.')
description = _('Queue could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -137,7 +137,7 @@ class ItemResource(object):
:returns: HTTP | 200,400,409,503
"""
LOG.debug(u'PATCH queue - name: %s', queue_name)
LOG.debug('PATCH queue - name: %s', queue_name)
try:
# Place JSON size restriction before parsing
@ -165,17 +165,17 @@ class ItemResource(object):
changes = wsgi_utils.sanitize(changes, doctype=list)
except utils.MalformedJSON as ex:
LOG.debug(ex)
description = _(u'Request body could not be parsed.')
description = _('Request body could not be parsed.')
raise wsgi_errors.HTTPBadRequestBody(description)
except utils.OverflowedJSONInteger as ex:
LOG.debug(ex)
description = _(u'JSON contains integer that is too large.')
description = _('JSON contains integer that is too large.')
raise wsgi_errors.HTTPBadRequestBody(description)
except Exception:
# Error while reading from the network/server
description = _(u'Request body could not be read.')
description = _('Request body could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
else:
@ -211,7 +211,7 @@ class ItemResource(object):
except wsgi_errors.HTTPConflict:
raise
except Exception:
description = _(u'Queue could not be updated.')
description = _('Queue could not be updated.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
for meta, value in _get_reserved_metadata(self._validate).items():
@ -272,7 +272,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Queues could not be listed.')
description = _('Queues could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -72,6 +72,6 @@ class Resource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Queue stats could not be read.')
description = _('Queue stats could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -55,7 +55,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Subscription could not be retrieved.')
description = _('Subscription could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -71,7 +71,7 @@ class ItemResource(object):
project=project_id)
except Exception:
description = _(u'Subscription could not be deleted.')
description = _('Subscription could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -102,7 +102,7 @@ class ItemResource(object):
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = (_(u'Subscription %(subscription_id)s could not be'
description = (_('Subscription %(subscription_id)s could not be'
' updated.') %
dict(subscription_id=subscription_id))
LOG.exception(description)
@ -148,7 +148,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Subscriptions could not be listed.')
description = _('Subscriptions could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -202,7 +202,7 @@ class CollectionResource(object):
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Subscription could not be created.')
description = _('Subscription could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -229,9 +229,9 @@ class CollectionResource(object):
queue_name, subscriber, project_id)
confirmed = subscription.get('confirmed', True)
if confirmed:
description = _(u'Such subscription already exists.'
u'Subscriptions are unique by project + queue '
u'+ subscriber URI.')
description = _('Such subscription already exists.'
'Subscriptions are unique by project + queue '
'+ subscriber URI.')
raise wsgi_errors.HTTPConflict(description,
headers={'location': req.path})
else:
@ -298,7 +298,7 @@ class ConfirmResource(object):
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = (_(u'Subscription %(subscription_id)s could not be'
description = (_('Subscription %(subscription_id)s could not be'
' confirmed.') %
dict(subscription_id=subscription_id))
LOG.exception(description)

View File

@ -65,7 +65,7 @@ class ItemResource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Topic metadata could not be retrieved.')
description = _('Topic metadata could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -98,7 +98,7 @@ class ItemResource(object):
LOG.exception('Flavor "%s" does not exist', topic_name)
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Topic could not be created.')
description = _('Topic could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -108,14 +108,14 @@ class ItemResource(object):
@decorators.TransportLog("Topics item")
@acl.enforce("topics:delete")
def on_delete(self, req, resp, project_id, topic_name):
LOG.debug(u'Topic item DELETE - topic: %(topic)s, '
u'project: %(project)s',
LOG.debug('Topic item DELETE - topic: %(topic)s, '
'project: %(project)s',
{'topic': topic_name, 'project': project_id})
try:
self._topic_controller.delete(topic_name, project=project_id)
except Exception:
description = _(u'Topic could not be deleted.')
description = _('Topic could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
@ -133,7 +133,7 @@ class ItemResource(object):
:returns: HTTP | 200,400,409,503
"""
LOG.debug(u'PATCH topic - name: %s', topic_name)
LOG.debug('PATCH topic - name: %s', topic_name)
try:
# Place JSON size restriction before parsing
@ -161,17 +161,17 @@ class ItemResource(object):
changes = wsgi_utils.sanitize(changes, doctype=list)
except utils.MalformedJSON as ex:
LOG.debug(ex)
description = _(u'Request body could not be parsed.')
description = _('Request body could not be parsed.')
raise wsgi_errors.HTTPBadRequestBody(description)
except utils.OverflowedJSONInteger as ex:
LOG.debug(ex)
description = _(u'JSON contains integer that is too large.')
description = _('JSON contains integer that is too large.')
raise wsgi_errors.HTTPBadRequestBody(description)
except Exception:
# Error while reading from the network/server
description = _(u'Request body could not be read.')
description = _('Request body could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
else:
@ -207,7 +207,7 @@ class ItemResource(object):
except wsgi_errors.HTTPConflict:
raise
except Exception:
description = _(u'Topic could not be updated.')
description = _('Topic could not be updated.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
for meta, value in _get_reserved_metadata(self._validate).items():
@ -263,7 +263,7 @@ class CollectionResource(object):
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Topics could not be listed.')
description = _('Topics could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -74,7 +74,7 @@ class Resource(object):
except ValueError as err:
raise wsgi_errors.HTTPBadRequestAPI(str(err))
except Exception:
description = _(u'Topic could not be purged.')
description = _('Topic could not be purged.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -72,6 +72,6 @@ class Resource(object):
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Topic stats could not be read.')
description = _('Topic stats could not be read.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -41,8 +41,8 @@ class Resource(object):
@decorators.TransportLog("Queues share item")
@acl.enforce("queues:share")
def on_post(self, req, resp, project_id, queue_name):
LOG.debug(u'Pre-Signed URL Creation for queue: %(queue)s, '
u'project: %(project)s',
LOG.debug('Pre-Signed URL Creation for queue: %(queue)s, '
'project: %(project)s',
{'queue': queue_name, 'project': project_id})
try: