Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Remove hacking and friends from lower-constraints, they are not needed
to be installed at run-time.

Change-Id: I602e3f3dd3f158799f910d73ac9c759efe15fcc0
This commit is contained in:
Andreas Jaeger 2020-04-02 10:01:27 +02:00
parent 22c457a55b
commit 1d9a681b83
22 changed files with 89 additions and 77 deletions

View File

@ -8,10 +8,8 @@ dogpile.cache==0.6.2
enum34==1.0.4;python_version=='2.7' enum34==1.0.4;python_version=='2.7'
falcon==1.1.0 falcon==1.1.0
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.5
future==0.16.0 future==0.16.0
futurist==1.2.0 futurist==1.2.0
hacking==0.12.0
iso8601==0.1.11 iso8601==0.1.11
jsonschema==2.6.0 jsonschema==2.6.0
keystoneauth1==3.4.0 keystoneauth1==3.4.0
@ -39,7 +37,6 @@ oslo.utils==3.33.0
oslotest==3.2.0 oslotest==3.2.0
osprofiler==1.4.0 osprofiler==1.4.0
pbr==2.0.0 pbr==2.0.0
pep8==1.5.7
Pygments==2.2.0 Pygments==2.2.0
pymongo==3.6.0 pymongo==3.6.0
PyMySQL==0.7.6 PyMySQL==0.7.6

View File

@ -81,6 +81,7 @@ class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
data = {'confirmed': confirmed_value} data = {'confirmed': confirmed_value}
requests.put(url=url, data=json.dumps(data), headers=headers) requests.put(url=url, data=json.dumps(data), headers=headers)
Handler = ServerHandler Handler = ServerHandler
httpd = SocketServer.TCPServer(("", PORT), Handler) httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever() httpd.serve_forever()

View File

@ -74,6 +74,7 @@ class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
data = {'confirmed': True} data = {'confirmed': True}
requests.put(url=url, data=json.dumps(data), headers=headers) requests.put(url=url, data=json.dumps(data), headers=headers)
Handler = ServerHandler Handler = ServerHandler
httpd = SocketServer.TCPServer(("", PORT), Handler) httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever() httpd.serve_forever()

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
# Metrics and style # Metrics and style
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
# Packaging # Packaging
mock>=2.0.0 # BSD mock>=2.0.0 # BSD

15
tox.ini
View File

@ -92,6 +92,15 @@ exclude = .venv*,.git,.tox,dist,doc,*lib/python*,*.egg,.update-venv
max-complexity = 20 max-complexity = 20
# [H904] Delay string interpolations at logging calls. # [H904] Delay string interpolations at logging calls.
enable-extensions=H904 enable-extensions=H904
# Ignored extensions, might be enabled again after review:
# E123 closing bracket does not match indentation of opening bracket's line
# E226 missing whitespace around arithmetic operator
# E241 multiple spaces after ','
# E402 module level import not at top of file
# E731 do not assign a lambda expression, use a def
# W503 line break before binary operator
# W504 line break after binary operator
ignore = E123,E226,E241,E402,E731,W503,W504
[doc8] [doc8]
# File extensions to check # File extensions to check
@ -100,8 +109,10 @@ extensions = .rst, .yaml
# Let's not get far more in. # Let's not get far more in.
max-line-length = 80 max-line-length = 80
[hacking] [flake8:local-plugins]
local-check-factory = zaqar.hacking.checks.factory extension =
N537 = checks:no_translate_logs
paths = ./zaqar/hacking
[testenv:lower-constraints] [testenv:lower-constraints]
deps = deps =

View File

@ -34,8 +34,8 @@ class ResponseSchema(api.Api):
"properties": { "properties": {
"href": { "href": {
"type": "string", "type": "string",
"pattern": "^(/v1/queues/[a-zA-Z0-9_-]" "pattern": r"^(/v1/queues/[a-zA-Z0-9_-]"
"{1,64}/messages/[a-zA-Z0-9_-]+)$" r"{1,64}/messages/[a-zA-Z0-9_-]+)$"
}, },
"age": age, "age": age,
"ttl": { "ttl": {
@ -54,9 +54,9 @@ class ResponseSchema(api.Api):
claim_href = { claim_href = {
"type": "string", "type": "string",
"pattern": "^(/v1/queues/[a-zA-Z0-9_-]{1,64}" "pattern": r"^(/v1/queues/[a-zA-Z0-9_-]{1,64}"
"/messages/[a-zA-Z0-9_-]+)" r"/messages/[a-zA-Z0-9_-]+)"
"\?claim_id=[a-zA-Z0-9_-]+$" r"\?claim_id=[a-zA-Z0-9_-]+$"
} }
self.schema = { self.schema = {
@ -74,7 +74,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
"pattern": "^/v1/queues\?", "pattern": r"^/v1/queues\?",
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -90,12 +90,12 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'name': { 'name': {
'type': 'string', 'type': 'string',
'pattern': '^[a-zA-Z0-9_-]{1,64}$' 'pattern': r'^[a-zA-Z0-9_-]{1,64}$'
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1/queues/' 'pattern': r'^/v1/queues/'
'[a-zA-Z0-9_-]{1,64}$', r'[a-zA-Z0-9_-]{1,64}$',
}, },
'metadata': { 'metadata': {
'type': 'object', 'type': 'object',
@ -158,7 +158,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1/pools\?' 'pattern': r'^/v1/pools\?'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -172,8 +172,8 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1/' 'pattern': r'^/v1/'
'pools/[a-zA-Z0-9_-]{1,64}$' r'pools/[a-zA-Z0-9_-]{1,64}$'
}, },
'weight': { 'weight': {
'type': 'number', 'type': 'number',
@ -212,8 +212,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1/queues/[a-zA-Z0-9_-]+' 'pattern': r'^/v1/queues/[a-zA-Z0-9_-]+'
'/messages\?(.)*$' r'/messages\?(.)*$'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -269,8 +269,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1/queues/[a-zA-Z0-9_-]+' 'pattern': r'^/v1/queues/[a-zA-Z0-9_-]+'
'/claims/[a-zA-Z0-9_-]+$' r'/claims/[a-zA-Z0-9_-]+$'
}, },
'messages': { 'messages': {
"type": "array", "type": "array",

View File

@ -37,8 +37,8 @@ class ResponseSchema(api.Api):
}, },
"href": { "href": {
"type": "string", "type": "string",
"pattern": "^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}" "pattern": r"^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}"
"/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$" r"/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$"
}, },
"age": age, "age": age,
"ttl": { "ttl": {
@ -60,9 +60,9 @@ class ResponseSchema(api.Api):
claim_href = { claim_href = {
"type": "string", "type": "string",
"pattern": "^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}" "pattern": r"^(/v1\.1/queues/[a-zA-Z0-9_-]{1,64}"
"/messages/[a-zA-Z0-9_-]+)" r"/messages/[a-zA-Z0-9_-]+)"
"\?claim_id=[a-zA-Z0-9_-]+$" r"\?claim_id=[a-zA-Z0-9_-]+$"
} }
flavor = { flavor = {
@ -70,7 +70,7 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/flavors/[a-zA-Z0-9_-]{1,64}$' 'pattern': r'^/v1\.1/flavors/[a-zA-Z0-9_-]{1,64}$'
}, },
'pool': { 'pool': {
'type': 'string', 'type': 'string',
@ -116,7 +116,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
"pattern": "^/v1\.1/queues\?", "pattern": r"^/v1\.1/queues\?",
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -137,8 +137,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/queues/' 'pattern': r'^/v1\.1/queues/'
'[a-zA-Z0-9_-]{1,64}$', r'[a-zA-Z0-9_-]{1,64}$',
}, },
'metadata': { 'metadata': {
'type': 'object', 'type': 'object',
@ -202,7 +202,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/pools\?' 'pattern': r'^/v1\.1/pools\?'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -216,8 +216,8 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/' 'pattern': r'^/v1\.1/'
'pools/[a-zA-Z0-9_-]{1,64}$' r'pools/[a-zA-Z0-9_-]{1,64}$'
}, },
'weight': { 'weight': {
'type': 'number', 'type': 'number',
@ -259,8 +259,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/queues/[a-zA-Z0-9_-]+' 'pattern': r'^/v1\.1/queues/[a-zA-Z0-9_-]+'
'/messages\?(.)*$' r'/messages\?(.)*$'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -293,8 +293,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/pools/' 'pattern': r'^/v1\.1/pools/'
'[a-zA-Z0-9_\-]+$' r'[a-zA-Z0-9_\-]+$'
}, },
'options': { 'options': {
'type': 'object', 'type': 'object',
@ -352,8 +352,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/queues/[a-zA-Z0-9_-]+' 'pattern': r'^/v1\.1/queues/[a-zA-Z0-9_-]+'
'/claims/[a-zA-Z0-9_-]+$' r'/claims/[a-zA-Z0-9_-]+$'
}, },
'messages': { 'messages': {
"type": "array", "type": "array",
@ -398,7 +398,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v1\.1/flavors\?' 'pattern': r'^/v1\.1/flavors\?'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],

View File

@ -434,7 +434,7 @@ class Endpoints(object):
try: try:
queue_meta = self._queue_controller.get_metadata(queue_name, queue_meta = self._queue_controller.get_metadata(queue_name,
project_id) project_id)
except storage_errors.DoesNotExist as ex: except storage_errors.DoesNotExist:
self._validate.queue_identification(queue_name, project_id) self._validate.queue_identification(queue_name, project_id)
self._queue_controller.create(queue_name, project=project_id) self._queue_controller.create(queue_name, project=project_id)
# NOTE(flwang): Queue is created in lazy mode, so no metadata # NOTE(flwang): Queue is created in lazy mode, so no metadata

View File

@ -37,8 +37,8 @@ class ResponseSchema(api.Api):
}, },
"href": { "href": {
"type": "string", "type": "string",
"pattern": "^(/v1/queues/[a-zA-Z0-9_-]{1,64}" "pattern": r"^(/v1/queues/[a-zA-Z0-9_-]{1,64}"
"/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$" r"/messages/[a-zA-Z0-9_-]+)(\?claim_id=[a-zA-Z0-9_-]+)?$"
}, },
"age": age, "age": age,
"ttl": { "ttl": {
@ -61,9 +61,9 @@ class ResponseSchema(api.Api):
claim_href = { claim_href = {
"type": "string", "type": "string",
"pattern": "^(/v2/queues/[a-zA-Z0-9_-]{1,64}" "pattern": r"^(/v2/queues/[a-zA-Z0-9_-]{1,64}"
"/messages/[a-zA-Z0-9_-]+)" r"/messages/[a-zA-Z0-9_-]+)"
"\?claim_id=[a-zA-Z0-9_-]+$" r"\?claim_id=[a-zA-Z0-9_-]+$"
} }
flavor = { flavor = {
@ -71,7 +71,7 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/flavors/[a-zA-Z0-9_-]{1,64}$' 'pattern': r'^/v2/flavors/[a-zA-Z0-9_-]{1,64}$'
}, },
'pool': { 'pool': {
'type': 'string', 'type': 'string',
@ -117,7 +117,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
"pattern": "^/v2/queues\?", "pattern": r"^/v2/queues\?",
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -134,12 +134,12 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'name': { 'name': {
'type': 'string', 'type': 'string',
'pattern': '^[a-zA-Z0-9_-]{1,64}$' 'pattern': r'^[a-zA-Z0-9_-]{1,64}$'
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/queues/' 'pattern': r'^/v2/queues/'
'[a-zA-Z0-9_-]{1,64}$', r'[a-zA-Z0-9_-]{1,64}$',
}, },
'metadata': { 'metadata': {
'type': 'object', 'type': 'object',
@ -203,7 +203,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/pools\?' 'pattern': r'^/v2/pools\?'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -217,8 +217,8 @@ class ResponseSchema(api.Api):
'properties': { 'properties': {
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/' 'pattern': r'^/v2/'
'pools/[a-zA-Z0-9_-]{1,64}$' r'pools/[a-zA-Z0-9_-]{1,64}$'
}, },
'weight': { 'weight': {
'type': 'number', 'type': 'number',
@ -260,8 +260,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/queues/[a-zA-Z0-9_-]+' 'pattern': r'^/v2/queues/[a-zA-Z0-9_-]+'
'/messages\?(.)*$' r'/messages\?(.)*$'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],
@ -294,8 +294,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/pools/' 'pattern': r'^/v2/pools/'
'[a-zA-Z0-9_\-]+$' r'[a-zA-Z0-9_\-]+$'
}, },
'options': { 'options': {
'type': 'object', 'type': 'object',
@ -353,8 +353,8 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/queues/[a-zA-Z0-9_-]+' 'pattern': r'^/v2/queues/[a-zA-Z0-9_-]+'
'/claims/[a-zA-Z0-9_-]+$' r'/claims/[a-zA-Z0-9_-]+$'
}, },
'messages': { 'messages': {
"type": "array", "type": "array",
@ -399,7 +399,7 @@ class ResponseSchema(api.Api):
}, },
'href': { 'href': {
'type': 'string', 'type': 'string',
'pattern': '^/v2/flavors\?' 'pattern': r'^/v2/flavors\?'
} }
}, },
'required': ['rel', 'href'], 'required': ['rel', 'href'],

View File

@ -50,5 +50,6 @@ def main():
return upgradecheck.main( return upgradecheck.main(
cfg.CONF, project='zaqar', upgrade_command=Checks()) cfg.CONF, project='zaqar', upgrade_command=Checks())
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@ -14,6 +14,7 @@
import re import re
from hacking import core
_all_log_levels = {'critical', 'error', 'exception', 'info', _all_log_levels = {'critical', 'error', 'exception', 'info',
'warning', 'debug'} 'warning', 'debug'}
@ -28,6 +29,7 @@ _log_translation_hint = re.compile(
}) })
@core.flake8ext
def no_translate_logs(logical_line): def no_translate_logs(logical_line):
"""N537 - Don't translate logs. """N537 - Don't translate logs.
@ -45,7 +47,3 @@ def no_translate_logs(logical_line):
""" """
if _log_translation_hint.match(logical_line): if _log_translation_hint.match(logical_line):
yield (0, "N537: Log messages should not be translated!") yield (0, "N537: Log messages should not be translated!")
def factory(register):
register(no_translate_logs)

View File

@ -404,7 +404,7 @@ class MessageController(storage.Message, scripting.Mixin):
# for performance. # for performance.
with self._client.pipeline() as pipe: with self._client.pipeline() as pipe:
for mid in message_ids: for mid in message_ids:
pipe.hgetall(mid) pipe.hgetall(mid)
messages = pipe.execute() messages = pipe.execute()
@ -578,6 +578,7 @@ def _filter_messages(messages, filters, to_basic, marker):
else: else:
yield msg yield msg
QUEUES_SET_STORE_NAME = 'queues_set' QUEUES_SET_STORE_NAME = 'queues_set'

View File

@ -69,6 +69,7 @@ def scope_queue_name(queue=None, project=None):
# TODO(prashanthr_) : Try to reuse this utility. Violates DRY # TODO(prashanthr_) : Try to reuse this utility. Violates DRY
return normalize_none_str(project) + '.' + normalize_none_str(queue) return normalize_none_str(project) + '.' + normalize_none_str(queue)
# NOTE(prashanthr_): Aliase the scope_queue_name function # NOTE(prashanthr_): Aliase the scope_queue_name function
# to be used in the pools and claims controller as similar # to be used in the pools and claims controller as similar
# functionality is required to scope redis id's. # functionality is required to scope redis id's.

View File

@ -90,6 +90,7 @@ def run_migrations_online():
finally: finally:
connection.close() connection.close()
if context.is_offline_mode(): if context.is_offline_mode():
run_migrations_offline() run_migrations_offline()
else: else:

View File

@ -34,7 +34,7 @@ MIN_SUBSCRIPTION_TTL = 60
_PURGBLE_RESOURCE_TYPES = {'messages', 'subscriptions'} _PURGBLE_RESOURCE_TYPES = {'messages', 'subscriptions'}
# NOTE(kgriffs): Don't use \w because it isn't guaranteed to match # NOTE(kgriffs): Don't use \w because it isn't guaranteed to match
# only ASCII characters. # only ASCII characters.
QUEUE_NAME_REGEX = re.compile('^[a-zA-Z0-9_\-.]+$') QUEUE_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_\-.]+$')
QUEUE_NAME_MAX_LEN = 64 QUEUE_NAME_MAX_LEN = 64
PROJECT_ID_MAX_LEN = 256 PROJECT_ID_MAX_LEN = 256
@ -125,7 +125,7 @@ class Validator(object):
if not pointer.startswith('/'): if not pointer.startswith('/'):
msg = _('Pointer `%s` does not start with "/".') % pointer msg = _('Pointer `%s` does not start with "/".') % pointer
raise ValidationFailed(msg) raise ValidationFailed(msg)
if re.search('/\s*?/', pointer[1:]): if re.search(r'/\s*?/', pointer[1:]):
msg = _('Pointer `%s` contains adjacent "/".') % pointer msg = _('Pointer `%s` contains adjacent "/".') % pointer
raise ValidationFailed(msg) raise ValidationFailed(msg)
if len(pointer) > 1 and pointer.endswith('/'): if len(pointer) > 1 and pointer.endswith('/'):
@ -134,7 +134,7 @@ class Validator(object):
if pointer[1:].strip() == '/': if pointer[1:].strip() == '/':
msg = _('Pointer `%s` does not contains valid token.') % pointer msg = _('Pointer `%s` does not contains valid token.') % pointer
raise ValidationFailed(msg) raise ValidationFailed(msg)
if re.search('~[^01]', pointer) or pointer.endswith('~'): if re.search(r'~[^01]', pointer) or pointer.endswith('~'):
msg = _('Pointer `%s` contains "~" not part of' msg = _('Pointer `%s` contains "~" not part of'
' a recognized escape sequence.') % pointer ' a recognized escape sequence.') % pointer
raise ValidationFailed(msg) raise ValidationFailed(msg)

View File

@ -54,7 +54,7 @@ class Resource(object):
resp.body = utils.to_json(resp_dict) resp.body = utils.to_json(resp_dict)
# status defaults to 200 # status defaults to 200
except storage_errors.QueueIsEmpty as ex: except storage_errors.QueueIsEmpty:
resp_dict = { resp_dict = {
'messages': { 'messages': {
'claimed': 0, 'claimed': 0,

View File

@ -54,7 +54,7 @@ class Resource(object):
# status defaults to 200 # status defaults to 200
except (storage_errors.QueueDoesNotExist, except (storage_errors.QueueDoesNotExist,
storage_errors.QueueIsEmpty) as ex: storage_errors.QueueIsEmpty):
resp_dict = { resp_dict = {
'messages': { 'messages': {
'claimed': 0, 'claimed': 0,

View File

@ -177,7 +177,7 @@ class CollectionResource(object):
try: try:
queue_meta = self._queue_controller.get_metadata(queue_name, queue_meta = self._queue_controller.get_metadata(queue_name,
project_id) project_id)
except storage_errors.DoesNotExist as ex: except storage_errors.DoesNotExist:
self._validate.queue_identification(queue_name, project_id) self._validate.queue_identification(queue_name, project_id)
self._queue_controller.create(queue_name, project=project_id) self._queue_controller.create(queue_name, project=project_id)
# NOTE(flwang): Queue is created in lazy mode, so no metadata # NOTE(flwang): Queue is created in lazy mode, so no metadata

View File

@ -208,7 +208,7 @@ class ItemResource(object):
except validation.ValidationFailed as ex: except validation.ValidationFailed as ex:
LOG.debug(ex) LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex)) raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex))
except wsgi_errors.HTTPConflict as ex: except wsgi_errors.HTTPConflict:
raise raise
except Exception: except Exception:
description = _(u'Queue could not be updated.') description = _(u'Queue could not be updated.')

View File

@ -58,7 +58,7 @@ class Resource(object):
# status defaults to 200 # status defaults to 200
except (storage_errors.QueueDoesNotExist, except (storage_errors.QueueDoesNotExist,
storage_errors.QueueIsEmpty) as ex: storage_errors.QueueIsEmpty):
resp_dict = { resp_dict = {
'messages': { 'messages': {
'claimed': 0, 'claimed': 0,

View File

@ -205,7 +205,7 @@ class ItemResource(object):
except validation.ValidationFailed as ex: except validation.ValidationFailed as ex:
LOG.debug(ex) LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex)) raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex))
except wsgi_errors.HTTPConflict as ex: except wsgi_errors.HTTPConflict:
raise raise
except Exception: except Exception:
description = _(u'Topic could not be updated.') description = _(u'Topic could not be updated.')

View File

@ -58,7 +58,7 @@ class Resource(object):
# status defaults to 200 # status defaults to 200
except (storage_errors.TopicDoesNotExist, except (storage_errors.TopicDoesNotExist,
storage_errors.TopicIsEmpty) as ex: storage_errors.TopicIsEmpty):
resp_dict = { resp_dict = {
'messages': { 'messages': {
'claimed': 0, 'claimed': 0,