Fix queue metadata update issue
Currently when updating queue's metadata, the default type of those metadata values are string. But in Zaqar some of them are integer. So this patch will convert those reserved metadata before saving. Closes-Bug: #1581253 Change-Id: I6e3a6b8f7dd96e1e475454fd7b721878adcb1bc8
This commit is contained in:
parent
4f93f39b4e
commit
d37f6483be
@ -12,9 +12,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import logging
|
import logging
|
||||||
|
import six
|
||||||
from zaqarclient.queues import client as zaqar_client
|
from zaqarclient.queues import client as zaqar_client
|
||||||
|
|
||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
@ -23,6 +23,8 @@ from openstack_dashboard.api import base
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
RESERVED_QUEUE_METADATA = ["_max_messages_post_size", "_default_message_ttl"]
|
||||||
|
|
||||||
|
|
||||||
@memoized
|
@memoized
|
||||||
def zaqarclient(request):
|
def zaqarclient(request):
|
||||||
@ -75,6 +77,10 @@ def queue_update(request, queue_name, metadata):
|
|||||||
# user can change ttl, max message size and metadata
|
# user can change ttl, max message size and metadata
|
||||||
|
|
||||||
queue = zaqarclient(request).queue(queue_name, auto_create=False)
|
queue = zaqarclient(request).queue(queue_name, auto_create=False)
|
||||||
|
for key in RESERVED_QUEUE_METADATA:
|
||||||
|
if (key in metadata and isinstance(metadata[key], six.string_types)):
|
||||||
|
metadata[key] = int(metadata[key])
|
||||||
|
|
||||||
queue.metadata(new_meta=metadata)
|
queue.metadata(new_meta=metadata)
|
||||||
return queue
|
return queue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user