)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"0c15004a08080f8b4d6daba515ab137c372db188","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"_extract_amp_image_id_by_tag should always return the last created image_id,"},{"line_number":10,"context_line":"with the \u0027amphora\u0027 tag, but it won\u0027t."},{"line_number":11,"context_line":"The reason is that the glance client currently returns an unsorted list."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"for the sort\u003d\u0027created_at\u0027 to work we should also provide a sorting direction."},{"line_number":14,"context_line":"Since we take the last element from the image we should use asc."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9a89bdaa_bd3736e2","line":11,"updated":"2016-09-05 09:37:59.000000000","message":"No I don\u0027t think so. As per the code in glance, it returns create_at:desc result if direction is not specified: https://github.com/openstack/glance/blob/master/glance/api/v2/images.py#L91","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"08dce644d278ac30d77fa6b8de2fcf614f0beb9f","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"_extract_amp_image_id_by_tag should always return the last created image_id,"},{"line_number":10,"context_line":"with the \u0027amphora\u0027 tag, but it won\u0027t."},{"line_number":11,"context_line":"The reason is that the glance client currently returns an unsorted list."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"for the sort\u003d\u0027created_at\u0027 to work we should also provide a sorting direction."},{"line_number":14,"context_line":"Since we take the last element from the image we should use asc."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9a89bdaa_322327a9","line":11,"in_reply_to":"9a89bdaa_bd3736e2","updated":"2016-09-11 12:59:33.000000000","message":"I stand corrected.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"0c15004a08080f8b4d6daba515ab137c372db188","unresolved":false,"context_lines":[{"line_number":10,"context_line":"with the \u0027amphora\u0027 tag, but it won\u0027t."},{"line_number":11,"context_line":"The reason is that the glance client currently returns an unsorted list."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"for the sort\u003d\u0027created_at\u0027 to work we should also provide a sorting direction."},{"line_number":14,"context_line":"Since we take the last element from the image we should use asc."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Closes-Bug #1618921"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9a89bdaa_7d5cce25","line":13,"updated":"2016-09-05 09:37:59.000000000","message":"No, it\u0027s just that the default is not what we wanted. It\u0027s using \u0027desc\u0027 right now.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"2d70c29980dae3ffbbabdcfc57903170d68974bf","unresolved":false,"context_lines":[{"line_number":10,"context_line":"with the \u0027amphora\u0027 tag, but it won\u0027t."},{"line_number":11,"context_line":"The reason is that the glance client currently returns an unsorted list."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"for the sort\u003d\u0027created_at\u0027 to work we should also provide a sorting direction."},{"line_number":14,"context_line":"Since we take the last element from the image we should use asc."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Closes-Bug #1618921"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9a89bdaa_8231f80d","line":13,"in_reply_to":"9a89bdaa_723ccfbf","updated":"2016-09-12 07:46:12.000000000","message":"Yeah. though it\u0027s not glanceclient default. it\u0027s server default.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"08dce644d278ac30d77fa6b8de2fcf614f0beb9f","unresolved":false,"context_lines":[{"line_number":10,"context_line":"with the \u0027amphora\u0027 tag, but it won\u0027t."},{"line_number":11,"context_line":"The reason is that the glance client currently returns an unsorted list."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"for the sort\u003d\u0027created_at\u0027 to work we should also provide a sorting direction."},{"line_number":14,"context_line":"Since we take the last element from the image we should use asc."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Closes-Bug #1618921"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9a89bdaa_723ccfbf","line":13,"in_reply_to":"9a89bdaa_7d5cce25","updated":"2016-09-11 12:59:33.000000000","message":"Ack. I in the next patch set I specified \u0027desc\u0027 as sorting direction so it won\u0027t break if the glanceclient default will change.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"29a1f4abe0c89b0316193017199fcafb52521df2","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"In addition, we now limit the length of the returned images list to 2."},{"line_number":16,"context_line":"The reason is that we don\u0027t need the whole list in order to warn the"},{"line_number":17,"context_line":"system administrator that more then one image has the \"amphora\" tag."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Closes-Bug #1618921"},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9a89bdaa_0d143942","line":17,"range":{"start_line":17,"start_character":54,"end_line":17,"end_character":63},"updated":"2016-09-12 07:47:33.000000000","message":"it\u0027s not \u0027amphora\u0027 tag, there is a config option for that tag, so please refer it, not a value used in devstack.","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"29a1f4abe0c89b0316193017199fcafb52521df2","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"In addition, we now limit the length of the returned images list to 2."},{"line_number":16,"context_line":"The reason is that we don\u0027t need the whole list in order to warn the"},{"line_number":17,"context_line":"system administrator that more then one image has the \"amphora\" tag."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Closes-Bug #1618921"},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9a89bdaa_020de83d","line":17,"range":{"start_line":17,"start_character":31,"end_line":17,"end_character":35},"updated":"2016-09-12 07:47:33.000000000","message":"than","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"ef0d2b163faa8fa4a8fdf5269cd884cf6dc94955","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"In addition, we now limit the length of the returned images list to 2."},{"line_number":16,"context_line":"The reason is that we don\u0027t need the whole list in order to warn the"},{"line_number":17,"context_line":"system administrator that more then one image has the \"amphora\" tag."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Closes-Bug #1618921"},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7a8ec9b2_01f6c5d6","line":17,"range":{"start_line":17,"start_character":54,"end_line":17,"end_character":63},"in_reply_to":"7a8ec9b2_cd7c27ee","updated":"2016-09-15 09:48:03.000000000","message":"Fixed those anyway :)","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"ef0d2b163faa8fa4a8fdf5269cd884cf6dc94955","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"In addition, we now limit the length of the returned images list to 2."},{"line_number":16,"context_line":"The reason is that we don\u0027t need the whole list in order to warn the"},{"line_number":17,"context_line":"system administrator that more then one image has the \"amphora\" tag."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Closes-Bug #1618921"},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7a8ec9b2_8109f5df","line":17,"range":{"start_line":17,"start_character":31,"end_line":17,"end_character":35},"in_reply_to":"9a89bdaa_020de83d","updated":"2016-09-15 09:48:03.000000000","message":"Done","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"ef0d2b163faa8fa4a8fdf5269cd884cf6dc94955","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"In addition, we now limit the length of the returned images list to 2."},{"line_number":16,"context_line":"The reason is that we don\u0027t need the whole list in order to warn the"},{"line_number":17,"context_line":"system administrator that more then one image has the \"amphora\" tag."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Closes-Bug #1618921"},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7a8ec9b2_a110b102","line":17,"range":{"start_line":17,"start_character":54,"end_line":17,"end_character":63},"in_reply_to":"9a89bdaa_0d143942","updated":"2016-09-15 09:48:03.000000000","message":"Done","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":11685,"name":"Stephen Balukoff","email":"stephen@balukoff.com","username":"sbalukoff"},"change_message_id":"eda24b8fe6269e883cba6b4f7603c3d8132a5ce4","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"In addition, we now limit the length of the returned images list to 2."},{"line_number":16,"context_line":"The reason is that we don\u0027t need the whole list in order to warn the"},{"line_number":17,"context_line":"system administrator that more then one image has the \"amphora\" tag."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Closes-Bug #1618921"},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7a8ec9b2_cd7c27ee","line":17,"range":{"start_line":17,"start_character":54,"end_line":17,"end_character":63},"in_reply_to":"9a89bdaa_0d143942","updated":"2016-09-14 21:38:07.000000000","message":"Ihar\u0027s points are both correct, but I think they\u0027re nits.","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"}],"octavia/compute/drivers/nova_driver.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"0c15004a08080f8b4d6daba515ab137c372db188","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_5a447073","line":36,"updated":"2016-09-05 09:37:59.000000000","message":"So I read the code for glance images listing at glance/api/v2/images.py:index(), and here are my findings:\n\nIf sort_dir is not passed, \u0027desc\u0027 is used as the sorting direction.\nIf sort_key is not passed, created_at is used as the sorting key.\nIf limit is not passed, then the result is limited to limit_param_default config option value that is 25 by default. There is also api_limit_max config option that may hard limit the number of results.\n\nWhich means, that the approach taken here won\u0027t work when e.g. the number of matching images is \u003e limit_param_default and/or api_limit_max.\n\nI think the best we can do is: 1) filter by created_at:desc and 2) extract the first image from the result. And since we don\u0027t really need more than two images (the 2nd needed to issue a warning), we can limit the result to just 2 items.\n\nThis should work in all cases, even when operators don\u0027t clean up older images.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"08dce644d278ac30d77fa6b8de2fcf614f0beb9f","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_126e23c9","line":36,"in_reply_to":"9a89bdaa_5a447073","updated":"2016-09-11 12:59:33.000000000","message":"Done","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":11628,"name":"Michael Johnson","email":"johnsomor@gmail.com","username":"johnsom"},"change_message_id":"d96e6666d8f6fdd68ea8d84b2096a70baa614f75","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_d02285a2","line":36,"in_reply_to":"9a89bdaa_5a447073","updated":"2016-09-08 00:25:47.000000000","message":"Yes, agreed.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"0c15004a08080f8b4d6daba515ab137c372db188","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_3d040614","line":38,"updated":"2016-09-05 09:37:59.000000000","message":"Basically, we were using desc before (as per what I see in glance code). Meaning the code was using the *older* image not the newer one.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":11685,"name":"Stephen Balukoff","email":"stephen@balukoff.com","username":"sbalukoff"},"change_message_id":"608ade5506d6ff520c3a5e6a5eaac4f68616a5ec","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"},{"line_number":42,"context_line":"    num_images \u003d len(images)"},{"line_number":43,"context_line":"    if num_images \u003e 1:"},{"line_number":44,"context_line":"        LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_0f15eae3","line":41,"range":{"start_line":38,"start_character":0,"end_line":41,"end_character":31},"updated":"2016-09-01 19:21:30.000000000","message":"Wouldn\u0027t it be quicker to sort by created_at:desc and then just grab the .first() entry (rather than retrieving a whole list and grabbing the last element from the list)?","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"08dce644d278ac30d77fa6b8de2fcf614f0beb9f","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"},{"line_number":42,"context_line":"    num_images \u003d len(images)"},{"line_number":43,"context_line":"    if num_images \u003e 1:"},{"line_number":44,"context_line":"        LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_b2e2d72d","line":41,"range":{"start_line":38,"start_character":0,"end_line":41,"end_character":31},"in_reply_to":"9a89bdaa_50183575","updated":"2016-09-11 12:59:33.000000000","message":"Done","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ce2167f7cd1a4b220a92ab0b69afddb8d8bc04f4","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"},{"line_number":42,"context_line":"    num_images \u003d len(images)"},{"line_number":43,"context_line":"    if num_images \u003e 1:"},{"line_number":44,"context_line":"        LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_b31ede09","line":41,"range":{"start_line":38,"start_character":0,"end_line":41,"end_character":31},"in_reply_to":"9a89bdaa_50183575","updated":"2016-09-08 08:46:15.000000000","message":"If the result is single, we can also still determine whether there are more matches by inspecting next href links in the response. Not sure if it\u0027s exposed by glanceclient itself though.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":11628,"name":"Michael Johnson","email":"johnsomor@gmail.com","username":"johnsom"},"change_message_id":"d96e6666d8f6fdd68ea8d84b2096a70baa614f75","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"},{"line_number":42,"context_line":"    num_images \u003d len(images)"},{"line_number":43,"context_line":"    if num_images \u003e 1:"},{"line_number":44,"context_line":"        LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_50183575","line":41,"range":{"start_line":38,"start_character":0,"end_line":41,"end_character":31},"in_reply_to":"9a89bdaa_da2fa09f","updated":"2016-09-08 00:25:47.000000000","message":"I think there is value in a \"hey dummy\" warning message, but I agree, this might get to be large if some operator has a lot of image storage space and never cleans them up.\nA happy medium might be to pull back a list limited to 2 and re-write the message to warn of one or more.","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"17ebb01fe5cee38adb75e85087b476af5299ae67","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"},{"line_number":42,"context_line":"    num_images \u003d len(images)"},{"line_number":43,"context_line":"    if num_images \u003e 1:"},{"line_number":44,"context_line":"        LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_ed244e0e","line":41,"range":{"start_line":38,"start_character":0,"end_line":41,"end_character":31},"in_reply_to":"fa7ab95a_0f15eae3","updated":"2016-09-01 20:20:19.000000000","message":"Doable. but we would have to ommit lines 42-47, no?\nare we okay with that?","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"0c15004a08080f8b4d6daba515ab137c372db188","unresolved":false,"context_lines":[{"line_number":35,"context_line":"def _extract_amp_image_id_by_tag(client, image_tag):"},{"line_number":36,"context_line":"    images \u003d list(client.images.list("},{"line_number":37,"context_line":"        filters\u003d{\u0027tag\u0027: [image_tag]},"},{"line_number":38,"context_line":"        sort\u003d\u0027created_at:asc\u0027))"},{"line_number":39,"context_line":"    if not images:"},{"line_number":40,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":41,"context_line":"    image_id \u003d images[-1][\u0027id\u0027]"},{"line_number":42,"context_line":"    num_images \u003d len(images)"},{"line_number":43,"context_line":"    if num_images \u003e 1:"},{"line_number":44,"context_line":"        LOG.warning("}],"source_content_type":"text/x-python","patch_set":1,"id":"9a89bdaa_da2fa09f","line":41,"range":{"start_line":38,"start_character":0,"end_line":41,"end_character":31},"in_reply_to":"fa7ab95a_ed244e0e","updated":"2016-09-05 09:37:59.000000000","message":"Agreed we don\u0027t need the whole list. First, it\u0027s wasteful, second, it may not work for some specific setups (where limit_param_default is e.g. 1, or where operators don\u0027t ever clean up the tag despite the warning message).","commit_id":"25765f3690b83fc5baab1ce5806e13eaa0dd5ba4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"7850dbc2cabca79fd614fda4958be9aafe5674dd","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":42,"context_line":"    image_id \u003d images[0][\u0027id\u0027]"},{"line_number":43,"context_line":"    num_images \u003d len(images)"},{"line_number":44,"context_line":"    if num_images \u003e 1:"},{"line_number":45,"context_line":"        LOG.warning("},{"line_number":46,"context_line":"            _LW(\"A single Glance image should be tagged with %(tag)s tag, \""},{"line_number":47,"context_line":"                \"but at least two were found. Using %(image_id)s.\"),"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a89bdaa_22acac34","line":44,"updated":"2016-09-12 07:45:24.000000000","message":"maybe at least add a note that the check is not ideal, because in theory the glance server may return 1 element per page max. In which case you can\u0027t detect multiple images here (but we could use href next link presence for that).","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"210642dcc45101e0f81ffe090250a77525379ae3","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":42,"context_line":"    image_id \u003d images[0][\u0027id\u0027]"},{"line_number":43,"context_line":"    num_images \u003d len(images)"},{"line_number":44,"context_line":"    if num_images \u003e 1:"},{"line_number":45,"context_line":"        LOG.warning("},{"line_number":46,"context_line":"            _LW(\"A single Glance image should be tagged with %(tag)s tag, \""},{"line_number":47,"context_line":"                \"but at least two were found. Using %(image_id)s.\"),"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_d4b100e3","line":44,"in_reply_to":"7a8ec9b2_0deb6fb1","updated":"2016-09-15 09:11:14.000000000","message":"It\u0027s not the client that could limit the page to 1, it may in theory be the server default. I agree though that spending time right now to solve that potential issue may be not really needed. Who would configure their glance server in such a weird way?..","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"8fbd9f3c3970deb91bf2f036824710e38e9b1107","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":42,"context_line":"    image_id \u003d images[0][\u0027id\u0027]"},{"line_number":43,"context_line":"    num_images \u003d len(images)"},{"line_number":44,"context_line":"    if num_images \u003e 1:"},{"line_number":45,"context_line":"        LOG.warning("},{"line_number":46,"context_line":"            _LW(\"A single Glance image should be tagged with %(tag)s tag, \""},{"line_number":47,"context_line":"                \"but at least two were found. Using %(image_id)s.\"),"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_016a451a","line":44,"in_reply_to":"7a8ec9b2_216e6195","updated":"2016-09-15 09:54:19.000000000","message":"I don\u0027t think there is a client default. I would expect the client to return whatever server returns in the page.\n\nSetting page_size\u003d2 will not override server default. That\u0027s why the only way to detect more matching images is by inspecting href next link to see if it\u0027s not None. I don\u0027t know if the glance client exposes such information to the consuming code though. And I don\u0027t think it\u0027s critical to handle that weird use case in this patch, instead leaving it up to future contributions in case anyone hits it. That said, having a NOTE about the reasoning here will help that future contributor to understand what\u0027s going.","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"ef0d2b163faa8fa4a8fdf5269cd884cf6dc94955","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":42,"context_line":"    image_id \u003d images[0][\u0027id\u0027]"},{"line_number":43,"context_line":"    num_images \u003d len(images)"},{"line_number":44,"context_line":"    if num_images \u003e 1:"},{"line_number":45,"context_line":"        LOG.warning("},{"line_number":46,"context_line":"            _LW(\"A single Glance image should be tagged with %(tag)s tag, \""},{"line_number":47,"context_line":"                \"but at least two were found. Using %(image_id)s.\"),"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_216e6195","line":44,"in_reply_to":"7a8ec9b2_d4b100e3","updated":"2016-09-15 09:48:03.000000000","message":"Will it be reasonable to add page_size\u003d2 to the query?\nI imagine it will not override a server default, but it would overcome a client default in case it\u0027s \u003c 2.","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"},{"author":{"_account_id":11685,"name":"Stephen Balukoff","email":"stephen@balukoff.com","username":"sbalukoff"},"change_message_id":"eda24b8fe6269e883cba6b4f7603c3d8132a5ce4","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        raise exceptions.GlanceNoTaggedImages(tag\u003dimage_tag)"},{"line_number":42,"context_line":"    image_id \u003d images[0][\u0027id\u0027]"},{"line_number":43,"context_line":"    num_images \u003d len(images)"},{"line_number":44,"context_line":"    if num_images \u003e 1:"},{"line_number":45,"context_line":"        LOG.warning("},{"line_number":46,"context_line":"            _LW(\"A single Glance image should be tagged with %(tag)s tag, \""},{"line_number":47,"context_line":"                \"but at least two were found. Using %(image_id)s.\"),"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_0deb6fb1","line":44,"in_reply_to":"9a89bdaa_22acac34","updated":"2016-09-14 21:38:07.000000000","message":"Ihar: Would that realistically ever happen (1 element per page) given how the glance client is being called above? If there\u0027s essentially no danger of that happening, I don\u0027t see anything wrong with the code, nor a reason to add a note about it.\n\nOtherwise, is there a way to tell the glance client to not use pagination (or whatever is limiting to 1 element per page)? We don\u0027t really want or need to see more than two images to generate the warning below... but it would be annoying if the client limits to just one per page for some reason.","commit_id":"b1704de4ffbd4b419a74a7ff642163960229f49b"}]}
