Unable to get, post or update queue metadata

Bug #1570715 reported by Neerja Narayan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Invalid
Undecided
Unassigned

Bug Description

Environment : wsgi , mongodb

Requesting queue metadata:

How do we make a request to just know the queue metadata like in v1?
Is /metadata deprecated?
If its deprecated then is it not completely removed from v1_1 and v2 ?
Sorry too many questions! :)

Posting queue metadata :

Scenario1 : Queue is create with metadata ==> 201 Created
Scenario2 : Queue is created without metadata ==> 201 Created
                     Now using the same queue , adding metadata in the request ==>204 No content , but no metadata gets added to the queue

curl -i -X PUT http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -H "Client-ID: $CLIENT_ID"

HTTP/1.0 201 Created

curl -i -X PUT http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -H "Client-ID: $CLIENT_ID" -d '{"metadata": "My Queue"}'

HTTP/1.0 204 No Content

Updating queue metadata

curl -i -X PUT http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -H "Client-ID: $CLIENT_ID" -d '{"metadata": "My Queue"}'

HTTP/1.0 201 Created

curl -i -X PUT http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -H "Client-ID: $CLIENT_ID" -d '{"metadata": "Updating Queue metadata"}'

HTTP/1.0 204 No Content

curl -i -X GET http://10.20.33.5:8888/v2/queues/neerja -H "X-Auth-Token: 7e489cf5881b4afeb0fc9cbaba3772c2" -H "Content-type: application/json" -H "Client-ID: de305d54-75b4-431b-adb2-eb6b9e546014"

HTTP/1.0 200 OK

{"_max_messages_post_size": 262144, "_default_message_ttl": 1209600, "metadata": "My Queue"}

Thank you :)

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

PUT meas to create a queue.
And you should use PATCH in v2 to update the queue's metadata: https://review.openstack.org/#/c/292843/

I have a client patch to add the update metadata command : https://review.openstack.org/#/c/294368/
also a patch to fix some errors : https://review.openstack.org/#/c/305560/

the request should be like:
PATCH http://IP:8888/v2/queues/queue_name
the request body should be like:
[
  {
     "op":"add",
     "patch":"/metadata/type",
     "value":"test"
  }
]

then the queue's metadata will be like :{"_max_messages_post_size": 262144, "_default_message_ttl": 1209600, "type": "test"}

Revision history for this message
Neerja Narayan (n-neerja28) wrote :

Hey wangxiyuan, thank you so much. I understood where I was going wrong. And I have a minor glitch in the following ,

curl -i -X PUT http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -d '{"metadata": "My Queue"}' -H "Client-ID: $CLient_ID"

201 created.

 curl -i -X PATCH http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -H "Accept: application/openstack-messaging-v2.0-json-patch" -d '[{"op":"add","patch":"/metadata/type","value":"test"}]' -H "Client-ID: $CLient_ID"

406 Not Acceptable

Any idea why so?

Thank you! :)

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

curl -i -X PATCH http://IP:8888/v2/queues/queue_name -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" -H "Accept: application/openstack-messaging-v2.0-json-patch" -d '[{"op":"add","patch":"/metadata/type","value":"test"}]' -H "Client-ID: $CLient_ID"

So there are some errors in your PATCH request:
1. "Content-type" should be "application/openstack-messaging-v2.0-json-patch"
2. "Accept" should be "application/json"
3. the body should be "[{"op":"add","path":"/metadata/type","value":"test"}]" (sorry for my comment before. It should be "path", not "patch")

Changed in zaqar:
status: New → Incomplete
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.