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 (cherry picked from commit d37f6483be14698500e7e2ac37d6d44bc82d9530)
This commit is contained in:
parent
440a1032b0
commit
82bc91e962
@ -12,9 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
import logging
|
||||
import six
|
||||
from zaqarclient.queues import client as zaqar_client
|
||||
|
||||
from horizon import exceptions
|
||||
@ -23,6 +23,8 @@ from openstack_dashboard.api import base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
RESERVED_QUEUE_METADATA = ["_max_messages_post_size", "_default_message_ttl"]
|
||||
|
||||
|
||||
@memoized
|
||||
def zaqarclient(request):
|
||||
@ -75,6 +77,10 @@ def queue_update(request, queue_name, metadata):
|
||||
# user can change ttl, max message size and metadata
|
||||
|
||||
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)
|
||||
return queue
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user