)]}'
{"zaqarclient/queues/v1/cli.py":[{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"7bb45f4719a5e4e0be9199df44a7d8e3ba23dd33","unresolved":false,"context_lines":[{"line_number":202,"context_line":"        queue_name \u003d parsed_args.queue_name"},{"line_number":203,"context_line":"        queue \u003d client.queue(queue_name, auto_create\u003dFalse)"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        if queue.metadata() is None:"},{"line_number":206,"context_line":"            raise RuntimeError(\u0027Queue(%s) does not exist.\u0027 % queue_name)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        columns \u003d (\"Stats\",)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_6ea8d98d","line":205,"range":{"start_line":205,"start_character":8,"end_line":205,"end_character":36},"updated":"2016-01-23 16:46:58.000000000","message":"This condition always evaluates to False. So I never catch the exception when run:\n\n$ openstack queue stats my-unexisting-queue --os-queues-api-version\u003d1.1\n+-------+---------------------------------------------------------+\n| Field | Value                                                   |\n+-------+---------------------------------------------------------+\n| Stats | {u\u0027messages\u0027: {u\u0027claimed\u0027: 0, u\u0027total\u0027: 0, u\u0027free\u0027: 0}} |\n+-------+---------------------------------------------------------+\n\n$ openstack queue stats my-unexisting-queue --os-queues-api-version\u003d1\n\n$\n\n\nAFAIK in api\u003d1 there are few ways how to check if queue exists, but there\u0027s no ways to do it in api\u003d\u003e1.1. It\u0027s not possible not only by client, but also by Zaqar server. Queue get or queue stats curl operations give no hint about queue exists or not. I don\u0027t know why it was made like this. Perhaps it should be fixed.\n\n\nFor now we can make the behavior of this CLI method similar to curl requests to Zaqar server(if it\u0027s api\u003e\u003d1.1, even if queue does not exist, let it return stats):\n\n\nif client.api_version \u003d\u003d 1 and not queue.exists():\n    raise RuntimeError(\u0027Queue(%s) does not exist.\u0027 % queue_name)\n\n\n\n\nNOTE: I used patch https://review.openstack.org/267906 to be able to run commands with --os-queues-api-version\u003d1. Perhaps you should rebase this patch too to the patch under the link.","commit_id":"2da637db62af8b7ba9d3165e0614fb165fcac882"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"23bf1e6ea7a8472ed73b8af06a3d3e367ce4200d","unresolved":false,"context_lines":[{"line_number":202,"context_line":"        queue_name \u003d parsed_args.queue_name"},{"line_number":203,"context_line":"        queue \u003d client.queue(queue_name, auto_create\u003dFalse)"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        if queue.metadata() is None:"},{"line_number":206,"context_line":"            raise RuntimeError(\u0027Queue(%s) does not exist.\u0027 % queue_name)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        columns \u003d (\"Stats\",)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_59c11d53","line":205,"range":{"start_line":205,"start_character":8,"end_line":205,"end_character":36},"in_reply_to":"9a68dd71_6ea8d98d","updated":"2016-01-23 18:39:41.000000000","message":"Alternative (better, because uses only single request to Zaqar):\n\ntry:\n    stats \u003d queue.stats\nexcept errors.ResourceNotFound:\n    raise RuntimeError(\u0027Queue(%s) does not exist.\u0027 % queue_name)\ncolumns \u003d (\"Stats\",)\ndata \u003d dict(stats\u003dstats)","commit_id":"2da637db62af8b7ba9d3165e0614fb165fcac882"}]}
