)]}'
{"glanceclient/common/utils.py":[{"author":{"_account_id":14676,"name":"Kairat Kushaev","email":"kkushaev@mirantis.com","username":"kairat_kushaev"},"change_message_id":"0d48373764ed534c516ac284d76e12e78a285943","unresolved":false,"context_lines":[{"line_number":286,"context_line":"    sys.exit(exit_code)"},{"line_number":287,"context_line":""},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"def print_msg(msg\u003d\u0027\u0027):"},{"line_number":290,"context_line":"    if msg:"},{"line_number":291,"context_line":"        print(encodeutils.safe_decode(msg), file\u003dsys.stderr)"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_d25c411b","line":289,"updated":"2015-09-23 09:00:52.000000000","message":"Not sure that the parameter should be empty by default. If somebody passes empty parameter here then he is using the function incorrectly.\nIMO, we don\u0027t need \"if msg:\" condition also because the function is not useful at all when the message is empty.\nI also would recommend to rename function to print_error","commit_id":"36d33490a3ad11f1907dbe0823779ee56a27870f"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"35d6d34a4e4c22bd137fbe358ced2ceba0222d70","unresolved":false,"context_lines":[{"line_number":286,"context_line":"    sys.exit(exit_code)"},{"line_number":287,"context_line":""},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"def print_msg(msg\u003d\u0027\u0027):"},{"line_number":290,"context_line":"    if msg:"},{"line_number":291,"context_line":"        print(encodeutils.safe_decode(msg), file\u003dsys.stderr)"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_65a251b0","line":289,"in_reply_to":"ba15a1d1_528591cc","updated":"2015-09-23 09:30:22.000000000","message":"And I hope this function is for common usage. It does not just print error message. Like this patch, when delete image successfully, it also print a message. So this name maybe ok in my opinion.","commit_id":"36d33490a3ad11f1907dbe0823779ee56a27870f"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"5d8d2a35f0a90f31c10ad4f2c8fcf85515ece00b","unresolved":false,"context_lines":[{"line_number":286,"context_line":"    sys.exit(exit_code)"},{"line_number":287,"context_line":""},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"def print_msg(msg\u003d\u0027\u0027):"},{"line_number":290,"context_line":"    if msg:"},{"line_number":291,"context_line":"        print(encodeutils.safe_decode(msg), file\u003dsys.stderr)"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_528591cc","line":289,"in_reply_to":"ba15a1d1_d25c411b","updated":"2015-09-23 09:13:52.000000000","message":"Thanks, Kairat.","commit_id":"36d33490a3ad11f1907dbe0823779ee56a27870f"}],"glanceclient/v2/shell.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"4ae61469a530b1be99e82caf5b01b1c05bed71fe","unresolved":false,"context_lines":[{"line_number":320,"context_line":"            gc.images.delete(args_id)"},{"line_number":321,"context_line":"        except exc.HTTPNotFound:"},{"line_number":322,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":323,"context_line":"            utils.exit(msg)"},{"line_number":324,"context_line":""},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"@utils.arg(\u0027image_id\u0027, metavar\u003d\u0027\u003cIMAGE_ID\u003e\u0027,"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba15a1d1_25860714","line":323,"updated":"2015-09-21 07:50:42.000000000","message":"If we\u0027re deleting in batch, I don\u0027t think it should stop in cases were the image doesn\u0027t exist anymore. Instead, it should keep going and attempt to delete the rest of the images in the batch.","commit_id":"9a0ffff7b1ad6e13792cc1228f6fdecb8df707c0"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"ba101b994c32eb858a9cd05d53e41c251564fd9e","unresolved":false,"context_lines":[{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"        except exc.HTTPNotFound:"},{"line_number":323,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":324,"context_line":"            utils.print_msg(msg)"},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"        do_image_delete(gc, args)"},{"line_number":327,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"ba15a1d1_145bf055","line":324,"updated":"2015-09-21 10:14:21.000000000","message":"mmh, I don\u0027t think we need the `print_msg` utility here.\n\nI\u0027d have expected something a bit simpler, without requiring recursion. For example:\n\n    try:\n        gc.images.delete(args_id)\n    except exc.HTTPNotFound:\n        # This will print a msg just in\n        # the single image deletion case\n        if len(args.id) \u003d\u003d 1:\n            msg \u003d ...\n            utils.exit(msg)","commit_id":"fd45c368f10a1d19fda2eba5d80db3561b2d50bb"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"dd8a40ffb3528c8e38992cbb57cfabfed4cddb52","unresolved":false,"context_lines":[{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"        except exc.HTTPNotFound:"},{"line_number":323,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":324,"context_line":"            utils.print_msg(msg)"},{"line_number":325,"context_line":""},{"line_number":326,"context_line":"        do_image_delete(gc, args)"},{"line_number":327,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"ba15a1d1_17ad3231","line":324,"in_reply_to":"ba15a1d1_145bf055","updated":"2015-09-21 10:47:14.000000000","message":"suppose delete like : glance image-create wrong-id right-id.\nif use util.exit(), the process will exit with state code 1.\nThen the right one could not be deleted. We should go on delete image if get exc.HTTPNotFound. So we should not use exit IMHO.\n\nAnd my code has some mistake in logic.I\u0027ll submit one later.","commit_id":"fd45c368f10a1d19fda2eba5d80db3561b2d50bb"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"447eca61674f25f39c5af142bbf5bc7cbaea8738","unresolved":false,"context_lines":[{"line_number":319,"context_line":"    for args_id in args.id:"},{"line_number":320,"context_line":"        try:"},{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"            msg \u003d \"Request to delete image %s has been accepted.\" % args_id"},{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_8406791a","line":322,"updated":"2015-09-23 13:39:46.000000000","message":"Could you change this to: \"Deleted image %s\"","commit_id":"ea2688759679128fdd148bb11bf4cd2b238d5a64"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"ae92335542b20898b9865a9f0cb6b7588aa7a8fd","unresolved":false,"context_lines":[{"line_number":319,"context_line":"    for args_id in args.id:"},{"line_number":320,"context_line":"        try:"},{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"            msg \u003d \"Request to delete image %s has been accepted.\" % args_id"},{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_7580adbf","line":322,"in_reply_to":"ba15a1d1_8406791a","updated":"2015-09-24 00:55:42.000000000","message":"Done","commit_id":"ea2688759679128fdd148bb11bf4cd2b238d5a64"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"447eca61674f25f39c5af142bbf5bc7cbaea8738","unresolved":false,"context_lines":[{"line_number":320,"context_line":"        try:"},{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"            msg \u003d \"Request to delete image %s has been accepted.\" % args_id"},{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":326,"context_line":"            utils.print_msg(msg)"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_24b9ad15","line":323,"updated":"2015-09-23 13:39:46.000000000","message":"This will print the message to stderr, but it\u0027s a normal feedback to user that should go to stdout.","commit_id":"ea2688759679128fdd148bb11bf4cd2b238d5a64"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"ae92335542b20898b9865a9f0cb6b7588aa7a8fd","unresolved":false,"context_lines":[{"line_number":320,"context_line":"        try:"},{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"            msg \u003d \"Request to delete image %s has been accepted.\" % args_id"},{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":326,"context_line":"            utils.print_msg(msg)"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_9fc22952","line":323,"in_reply_to":"ba15a1d1_24b9ad15","updated":"2015-09-24 00:55:42.000000000","message":"Thanks.","commit_id":"ea2688759679128fdd148bb11bf4cd2b238d5a64"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"447eca61674f25f39c5af142bbf5bc7cbaea8738","unresolved":false,"context_lines":[{"line_number":326,"context_line":"            utils.print_msg(msg)"},{"line_number":327,"context_line":"            failure_flag \u003d True"},{"line_number":328,"context_line":"    if failure_flag:"},{"line_number":329,"context_line":"        error_msg \u003d \"Unable to delete some of the given images.\""},{"line_number":330,"context_line":"        utils.exit(error_msg)"},{"line_number":331,"context_line":""},{"line_number":332,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_a47e1d68","line":329,"updated":"2015-09-23 13:39:46.000000000","message":"I don\u0027t think this last message is needed, TBH. You can call `utils.exit` w/o message","commit_id":"ea2688759679128fdd148bb11bf4cd2b238d5a64"},{"author":{"_account_id":455,"name":"Stuart McLaren","email":"stuart.mclaren@hpe.com","username":"stuart-mclaren"},"change_message_id":"b1a49b2af329bd39b79c16c8ff785ede628f5fb4","unresolved":false,"context_lines":[{"line_number":312,"context_line":""},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"@utils.arg(\u0027id\u0027, metavar\u003d\u0027\u003cIMAGE_ID\u003e\u0027, nargs\u003d\u0027+\u0027,"},{"line_number":315,"context_line":"           help\u003d\u0027ID of images to delete.\u0027)"},{"line_number":316,"context_line":"def do_image_delete(gc, args):"},{"line_number":317,"context_line":"    \"\"\"Delete specified image.\"\"\""},{"line_number":318,"context_line":"    failure_flag \u003d False"}],"source_content_type":"text/x-python","patch_set":13,"id":"7a2fa921_3d13055d","line":315,"updated":"2015-10-08 10:34:53.000000000","message":"Maybe something like this would be a small bit clearer?\n\n\"ID of image(s) to delete. To delete more than one image a space separated list of IDs can be used.\"","commit_id":"592378666e41456ac2fc34d38e527f9f9ec32198"},{"author":{"_account_id":455,"name":"Stuart McLaren","email":"stuart.mclaren@hpe.com","username":"stuart-mclaren"},"change_message_id":"b1a49b2af329bd39b79c16c8ff785ede628f5fb4","unresolved":false,"context_lines":[{"line_number":319,"context_line":"    for args_id in args.id:"},{"line_number":320,"context_line":"        try:"},{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"            msg \u003d \"Deleted image %s.\" % args_id"},{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"}],"source_content_type":"text/x-python","patch_set":13,"id":"7a2fa921_bdf075ff","line":322,"updated":"2015-10-08 10:34:53.000000000","message":"Can we match the v1 output behaviour?\n\n1) Don\u0027t print anything when the image is deleted successfully","commit_id":"592378666e41456ac2fc34d38e527f9f9ec32198"},{"author":{"_account_id":455,"name":"Stuart McLaren","email":"stuart.mclaren@hpe.com","username":"stuart-mclaren"},"change_message_id":"8abd91d3a9b150e1e0b058d3476fd16781bff836","unresolved":false,"context_lines":[{"line_number":321,"context_line":"            gc.images.delete(args_id)"},{"line_number":322,"context_line":"            msg \u003d \"Deleted image %s.\" % args_id"},{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":326,"context_line":"            utils.print_msg(msg)"},{"line_number":327,"context_line":"            failure_flag \u003d True"}],"source_content_type":"text/x-python","patch_set":13,"id":"7a2fa921_680c593b","line":324,"updated":"2015-10-08 10:46:57.000000000","message":"This raises an exception if the image exists but we don\u0027t have permission to delete it (eg a public image):\n\n$ glance --debug --os-image-api-version 2  image-delete a0dbdc74-0265-49ac-a59e-8924fdc88445 \ncurl -g -i -X DELETE -H \u0027Accept-Encoding: gzip, deflate\u0027 -H \u0027Accept: */*\u0027 -H \u0027User-Agent: python-glanceclient\u0027 -H \u0027Connection: keep-alive\u0027 -H \u0027X-Auth-Token: {SHA1}350106759d4bbb49960ed62f25ff113fd12696f1\u0027 -H \u0027Content-Type: application/octet-stream\u0027 http://10.0.0.95:9292/v2/images/a0dbdc74-0265-49ac-a59e-8924fdc88445\nRequest returned failure status 403.\nTraceback (most recent call last):\n  File \"/mnt/sam/git/python-glanceclient/glanceclient/shell.py\", line 700, in main\n    args.func(client, args)\n  File \"/mnt/sam/git/python-glanceclient/glanceclient/v2/shell.py\", line 321, in do_image_delete\n    gc.images.delete(args_id)\n  File \"/mnt/sam/git/python-glanceclient/glanceclient/v2/images.py\", line 222, in delete\n    self.http_client.delete(url)\n  File \"/mnt/sam/git/python-glanceclient/glanceclient/common/http.py\", line 292, in delete\n    return self._request(\u0027DELETE\u0027, url, **kwargs)\n  File \"/mnt/sam/git/python-glanceclient/glanceclient/common/http.py\", line 272, in _request\n    resp, body_iter \u003d self._handle_response(resp)\n  File \"/mnt/sam/git/python-glanceclient/glanceclient/common/http.py\", line 93, in _handle_response\n    raise exc.from_response(resp, resp.content)\nHTTPForbidden: 403 Forbidden: You are not permitted to delete this image. (HTTP 403)\n403 Forbidden: You are not permitted to delete this image. (HTTP 403)\n\n\nThere\u0027s various ways to do this. v1 just catches the more general HTTPException. Potentially we could catch 404, 403, and then the more general one.","commit_id":"592378666e41456ac2fc34d38e527f9f9ec32198"},{"author":{"_account_id":455,"name":"Stuart McLaren","email":"stuart.mclaren@hpe.com","username":"stuart-mclaren"},"change_message_id":"b1a49b2af329bd39b79c16c8ff785ede628f5fb4","unresolved":false,"context_lines":[{"line_number":323,"context_line":"            utils.print_msg(msg)"},{"line_number":324,"context_line":"        except exc.HTTPNotFound:"},{"line_number":325,"context_line":"            msg \u003d \"No image with an ID of \u0027%s\u0027 exists.\" % args_id"},{"line_number":326,"context_line":"            utils.print_msg(msg)"},{"line_number":327,"context_line":"            failure_flag \u003d True"},{"line_number":328,"context_line":"    if failure_flag:"},{"line_number":329,"context_line":"        utils.exit()"}],"source_content_type":"text/x-python","patch_set":13,"id":"7a2fa921_3ddd456f","line":326,"updated":"2015-10-08 10:34:53.000000000","message":"2) print this to stderr (not stdout)","commit_id":"592378666e41456ac2fc34d38e527f9f9ec32198"},{"author":{"_account_id":14676,"name":"Kairat Kushaev","email":"kkushaev@mirantis.com","username":"kairat_kushaev"},"change_message_id":"abfa9fa48e39ebac7749192b1f734473a9a31420","unresolved":false,"context_lines":[{"line_number":326,"context_line":"            utils.print_msg(msg)"},{"line_number":327,"context_line":"            failure_flag \u003d True"},{"line_number":328,"context_line":"    if failure_flag:"},{"line_number":329,"context_line":"        utils.exit()"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":""},{"line_number":332,"context_line":"@utils.arg(\u0027image_id\u0027, metavar\u003d\u0027\u003cIMAGE_ID\u003e\u0027,"}],"source_content_type":"text/x-python","patch_set":13,"id":"9a1a9d01_1b52ffdd","line":329,"updated":"2015-09-28 09:28:03.000000000","message":"I am just curious if the following would be simplier:\nnot_found_images \u003d []\nfor args_id in args.id:\n   ....\n   except exc.HTTPNotFound:\n          not_found_images.append(args_id)\nif not_found_images:\n   msg \u003d # message about missed images\n   utils.exit(msg).","commit_id":"592378666e41456ac2fc34d38e527f9f9ec32198"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"2fd3d0462a44c2e320c7ae275bbf234806918232","unresolved":false,"context_lines":[{"line_number":326,"context_line":"            utils.print_msg(msg)"},{"line_number":327,"context_line":"            failure_flag \u003d True"},{"line_number":328,"context_line":"    if failure_flag:"},{"line_number":329,"context_line":"        utils.exit()"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":""},{"line_number":332,"context_line":"@utils.arg(\u0027image_id\u0027, metavar\u003d\u0027\u003cIMAGE_ID\u003e\u0027,"}],"source_content_type":"text/x-python","patch_set":13,"id":"9a1a9d01_a4809447","line":329,"in_reply_to":"9a1a9d01_1b52ffdd","updated":"2015-09-28 10:29:30.000000000","message":"Thanks,Kairat. It will be more simple indeed. But my code could output message immediately and in order. Need more reviewer to vote. :)","commit_id":"592378666e41456ac2fc34d38e527f9f9ec32198"}]}
