)]}'
{"glance/async_/flows/_internal_plugins/web_download.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a3d574888f392e1969708c85de26c4f6a2a6a287","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        path, bytes_written \u003d self.store.add(self.image_id, data, 0)[0:2]"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            if bytes_written !\u003d int(data.headers[\u0027content-length\u0027]):"},{"line_number":123,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downladed data \""},{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_1c59b58d","line":123,"range":{"start_line":123,"start_character":58,"end_line":123,"end_character":67},"updated":"2020-09-15 17:35:48.000000000","message":"downloaded","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"56e82dc4b8ffc3c4459afcdba2e7ce4f9be7f7d7","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        path, bytes_written \u003d self.store.add(self.image_id, data, 0)[0:2]"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            if bytes_written !\u003d int(data.headers[\u0027content-length\u0027]):"},{"line_number":123,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downladed data \""},{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_a607cf81","line":123,"range":{"start_line":123,"start_character":58,"end_line":123,"end_character":67},"in_reply_to":"9f560f44_1c59b58d","updated":"2020-09-16 07:31:51.000000000","message":"Done","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a3d574888f392e1969708c85de26c4f6a2a6a287","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            if bytes_written !\u003d int(data.headers[\u0027content-length\u0027]):"},{"line_number":123,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downladed data \""},{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":127,"context_line":"                        \"expected\": data.headers[\u0027content-length\u0027]})"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_bc96c9ee","line":124,"range":{"start_line":124,"start_character":43,"end_line":124,"end_character":44},"updated":"2020-09-15 17:35:48.000000000","message":"i","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"56e82dc4b8ffc3c4459afcdba2e7ce4f9be7f7d7","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            if bytes_written !\u003d int(data.headers[\u0027content-length\u0027]):"},{"line_number":123,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downladed data \""},{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":127,"context_line":"                        \"expected\": data.headers[\u0027content-length\u0027]})"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_e601c76c","line":124,"range":{"start_line":124,"start_character":43,"end_line":124,"end_character":44},"in_reply_to":"9f560f44_bc96c9ee","updated":"2020-09-16 07:31:51.000000000","message":"Done","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a3d574888f392e1969708c85de26c4f6a2a6a287","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            if bytes_written !\u003d int(data.headers[\u0027content-length\u0027]):"},{"line_number":123,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downladed data \""},{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":127,"context_line":"                        \"expected\": data.headers[\u0027content-length\u0027]})"},{"line_number":128,"context_line":"                raise exception.ImportTaskError(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_fca04145","line":125,"range":{"start_line":125,"start_character":35,"end_line":125,"end_character":36},"updated":"2020-09-15 17:35:48.000000000","message":"i","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"56e82dc4b8ffc3c4459afcdba2e7ce4f9be7f7d7","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            if bytes_written !\u003d int(data.headers[\u0027content-length\u0027]):"},{"line_number":123,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downladed data \""},{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":127,"context_line":"                        \"expected\": data.headers[\u0027content-length\u0027]})"},{"line_number":128,"context_line":"                raise exception.ImportTaskError(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_46f6b392","line":125,"range":{"start_line":125,"start_character":35,"end_line":125,"end_character":36},"in_reply_to":"9f560f44_fca04145","updated":"2020-09-16 07:31:51.000000000","message":"Done","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a3d574888f392e1969708c85de26c4f6a2a6a287","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":127,"context_line":"                        \"expected\": data.headers[\u0027content-length\u0027]})"},{"line_number":128,"context_line":"                raise exception.ImportTaskError(msg)"},{"line_number":129,"context_line":"        except KeyError:"},{"line_number":130,"context_line":"            LOG.debug("}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_1cb5357f","line":127,"range":{"start_line":127,"start_character":36,"end_line":127,"end_character":66},"updated":"2020-09-15 17:35:48.000000000","message":"You can int() this here because you\u0027ve already done it in the conditional. Or, just grab/int() it once above and check/report.","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"56e82dc4b8ffc3c4459afcdba2e7ce4f9be7f7d7","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                         \"size %(data_size)s is different from expected %(\""},{"line_number":125,"context_line":"                         \"expected)s\") %"},{"line_number":126,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":127,"context_line":"                        \"expected\": data.headers[\u0027content-length\u0027]})"},{"line_number":128,"context_line":"                raise exception.ImportTaskError(msg)"},{"line_number":129,"context_line":"        except KeyError:"},{"line_number":130,"context_line":"            LOG.debug("}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_86f0cb93","line":127,"range":{"start_line":127,"start_character":36,"end_line":127,"end_character":66},"in_reply_to":"9f560f44_1cb5357f","updated":"2020-09-16 07:31:51.000000000","message":"Done","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"a3d574888f392e1969708c85de26c4f6a2a6a287","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        except KeyError:"},{"line_number":130,"context_line":"            LOG.debug("},{"line_number":131,"context_line":"                \"Task %(task_id)s can\u0027t read content-length for uri %(uri)s\","},{"line_number":132,"context_line":"                {\"task_id\": self.task_id, \"uri\": self.uri})"},{"line_number":133,"context_line":"        return path"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"    def revert(self, result, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_dc5f3d4b","line":132,"updated":"2020-09-15 17:35:48.000000000","message":"I\u0027m not really sure this new debug message is that useful. It\u0027s not an error, you don\u0027t report when we check it and it succeeds, if we tolerate the case where content-length is not provided, why log it?","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        except KeyError:"},{"line_number":130,"context_line":"            LOG.debug("},{"line_number":131,"context_line":"                \"Task %(task_id)s can\u0027t read content-length for uri %(uri)s\","},{"line_number":132,"context_line":"                {\"task_id\": self.task_id, \"uri\": self.uri})"},{"line_number":133,"context_line":"        return path"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"    def revert(self, result, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_bfd4e9ea","line":132,"in_reply_to":"9f560f44_06803bbf","updated":"2020-09-16 14:38:37.000000000","message":"Yeah, I know, it would just emit this for anything that does streaming of the image, which could be a lot of cases depending on how people are using it. Since the user (which might wonder why their image is broken) can\u0027t see the log files, they would have to ask the operator to look for them. In reality, they can just compare the expected size to the size of the image and know if it was truncated, without help from the operator.\n\nAnyway, my preference would be to remove it (as you did), but that\u0027s just MHO.","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"56e82dc4b8ffc3c4459afcdba2e7ce4f9be7f7d7","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        except KeyError:"},{"line_number":130,"context_line":"            LOG.debug("},{"line_number":131,"context_line":"                \"Task %(task_id)s can\u0027t read content-length for uri %(uri)s\","},{"line_number":132,"context_line":"                {\"task_id\": self.task_id, \"uri\": self.uri})"},{"line_number":133,"context_line":"        return path"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"    def revert(self, result, **kwargs):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_06803bbf","line":132,"in_reply_to":"9f560f44_dc5f3d4b","updated":"2020-09-16 07:31:51.000000000","message":"It was in the case we still have incomplete data and don\u0027t know where it come from. I remove it if you find it not relevant.","commit_id":"f6865f5617cf7e44b31e13a5868342b2e4ab99d9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        path, bytes_written \u003d self.store.add(self.image_id, data, 0)[0:2]"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            content_length \u003d int(data.headers[\u0027content-length\u0027])"},{"line_number":123,"context_line":"            if bytes_written !\u003d content_length:"},{"line_number":124,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downloaded data \""},{"line_number":125,"context_line":"                         \"size %(data_size)i is different from expected %(\""},{"line_number":126,"context_line":"                         \"expected)i\") %"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_5fe78dad","line":123,"updated":"2020-09-16 14:38:37.000000000","message":"You\u0027re not testing the case where this conditional is false.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"68ae767ad7a8336d3ef44f0ec8a41409602c3d75","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        path, bytes_written \u003d self.store.add(self.image_id, data, 0)[0:2]"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            content_length \u003d int(data.headers[\u0027content-length\u0027])"},{"line_number":123,"context_line":"            if bytes_written !\u003d content_length:"},{"line_number":124,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downloaded data \""},{"line_number":125,"context_line":"                         \"size %(data_size)i is different from expected %(\""},{"line_number":126,"context_line":"                         \"expected)i\") %"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_162304a9","line":123,"in_reply_to":"9f560f44_5fe78dad","updated":"2020-09-19 17:09:05.000000000","message":"Done","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":126,"context_line":"                         \"expected)i\") %"},{"line_number":127,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":128,"context_line":"                        \"expected\": content_length})"},{"line_number":129,"context_line":"                raise exception.IncompleteData(msg, path\u003dpath)"},{"line_number":130,"context_line":"        except KeyError:"},{"line_number":131,"context_line":"            pass"},{"line_number":132,"context_line":"        return path"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_7f66d157","line":129,"range":{"start_line":129,"start_character":52,"end_line":129,"end_character":61},"updated":"2020-09-16 14:38:37.000000000","message":"Why not just store this on the task itself, so that the revert() here can handle it instead of passing it through the exception? Just making L120 be:\n\n self.path, bytes_written \u003d self.store.add(...)\n\nwould do it. I guess I\u0027m not sure which is more taskflow-esque, but sending the context through the exception seems a little less integrated to me.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"1fdce7a2aab33f3783bf7631fd74c198832326f7","unresolved":false,"context_lines":[{"line_number":126,"context_line":"                         \"expected)i\") %"},{"line_number":127,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":128,"context_line":"                        \"expected\": content_length})"},{"line_number":129,"context_line":"                raise exception.IncompleteData(msg, path\u003dpath)"},{"line_number":130,"context_line":"        except KeyError:"},{"line_number":131,"context_line":"            pass"},{"line_number":132,"context_line":"        return path"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_fa85cf5a","line":129,"range":{"start_line":129,"start_character":52,"end_line":129,"end_character":61},"in_reply_to":"9f560f44_5a1f9b5a","updated":"2020-09-16 14:53:39.000000000","message":"I guess the question then is whether we clean the staging store in revert() or just leave it. I think you\u0027re saying that with direct, we would leave a partial thing in the staging store, and doing the same here would be most consistent. I\u0027m very pro-consistency, so that makes sense to me I think.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"0f3e29ccabfd69657271c00d242a93f0e66aea08","unresolved":false,"context_lines":[{"line_number":126,"context_line":"                         \"expected)i\") %"},{"line_number":127,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":128,"context_line":"                        \"expected\": content_length})"},{"line_number":129,"context_line":"                raise exception.IncompleteData(msg, path\u003dpath)"},{"line_number":130,"context_line":"        except KeyError:"},{"line_number":131,"context_line":"            pass"},{"line_number":132,"context_line":"        return path"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_5a1f9b5a","line":129,"range":{"start_line":129,"start_character":52,"end_line":129,"end_character":61},"in_reply_to":"9f560f44_7f66d157","updated":"2020-09-16 14:49:48.000000000","message":"+1,\nIt is better to save this as a part of task itself, passing attribute through exception doesn\u0027t fit well in taskflow.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"757c89177840ff9dbf16a6ec87db90c4ebb6bae8","unresolved":false,"context_lines":[{"line_number":126,"context_line":"                         \"expected)i\") %"},{"line_number":127,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":128,"context_line":"                        \"expected\": content_length})"},{"line_number":129,"context_line":"                raise exception.IncompleteData(msg, path\u003dpath)"},{"line_number":130,"context_line":"        except KeyError:"},{"line_number":131,"context_line":"            pass"},{"line_number":132,"context_line":"        return path"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_9a3bf337","line":129,"range":{"start_line":129,"start_character":52,"end_line":129,"end_character":61},"in_reply_to":"9f560f44_fa85cf5a","updated":"2020-09-16 15:10:25.000000000","message":"I think there is a difference here;\n\nfor glance-direct image is staged before import call is made, so if import is failed then the image-status will reverted back to uploading (which indicates data is in staging and we can reissue import call)\n\nIn case of web-download image is staged during import call it self so state transition is like \u003cqueued-uploading-importing-active\u003e and as we are setting image status back to queued in reviert call of this method then if we try to restage the data to same image using /stage call then it will raise Duplicate exception here (https://github.com/openstack/glance/blob/master/glance/api/v2/image_data.py#L345).\n\nSo that image is no longer useful and  we need to delete it. If we delete data in revert then we can use the image to stage the data and import call.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":128,"context_line":"                        \"expected\": content_length})"},{"line_number":129,"context_line":"                raise exception.IncompleteData(msg, path\u003dpath)"},{"line_number":130,"context_line":"        except KeyError:"},{"line_number":131,"context_line":"            pass"},{"line_number":132,"context_line":"        return path"},{"line_number":133,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_3f029970","line":130,"updated":"2020-09-16 14:38:37.000000000","message":"Nit, you could capture ValueError here as well to handle the case where the content-length header isn\u0027t a valid integer, just to provide a useful error, although I know it\u0027s unlikely.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"68ae767ad7a8336d3ef44f0ec8a41409602c3d75","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                       {\"task_id\": self.task_id, \"data_size\": bytes_written,"},{"line_number":128,"context_line":"                        \"expected\": content_length})"},{"line_number":129,"context_line":"                raise exception.IncompleteData(msg, path\u003dpath)"},{"line_number":130,"context_line":"        except KeyError:"},{"line_number":131,"context_line":"            pass"},{"line_number":132,"context_line":"        return path"},{"line_number":133,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_7639a0d6","line":130,"in_reply_to":"9f560f44_3f029970","updated":"2020-09-19 17:09:05.000000000","message":"Done","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"03998aa2788ee54f5843a45fa3d29e0d21b1178e","unresolved":false,"context_lines":[{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        self._path, bytes_written \u003d self.store.add(self.image_id, data, 0)[0:2]"},{"line_number":122,"context_line":"        try:"},{"line_number":123,"context_line":"            content_length \u003d int(data.headers[\u0027content-length\u0027])"},{"line_number":124,"context_line":"            if bytes_written !\u003d content_length:"},{"line_number":125,"context_line":"                msg \u003d (_(\"Task %(task_id)s failed because downloaded data \""},{"line_number":126,"context_line":"                         \"size %(data_size)i is different from expected %(\""}],"source_content_type":"text/x-python","patch_set":4,"id":"9f560f44_22b082dd","line":123,"range":{"start_line":123,"start_character":33,"end_line":123,"end_character":63},"updated":"2020-09-21 06:08:29.000000000","message":"If you could use data.get(\u0027content-length\u0027) here it will eliminate use of try except block, something like this::\n    content_length \u003d data.get(\u0027content-length\u0027)\n    if content_length and bytes_written !\u003d int(content_length):\n        msg \u003d (_(\"Task %(task_id)s failed because downloaded data \"\n                         \"size %(data_size)i is different from expected %(\"\n                         \"expected)i\") %\n                       {\"task_id\": self.task_id, \"data_size\": bytes_written,\n                        \"expected\": content_length})","commit_id":"e261630cc498335528ea7487e47cd34e3908f54a"}],"glance/common/exception.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":465,"context_line":"class IncompleteData(ImportTaskError):"},{"line_number":466,"context_line":"    message \u003d _(\"The download is incomplete.\")"},{"line_number":467,"context_line":""},{"line_number":468,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":469,"context_line":"        self.path \u003d kwargs.get(\u0027path\u0027, None)"},{"line_number":470,"context_line":"        super(IncompleteData, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_ff15c19c","line":470,"range":{"start_line":468,"start_character":0,"end_line":470,"end_character":61},"updated":"2020-09-16 14:38:37.000000000","message":"Seems like this should be built into the base class if we want to allow this, but I see a couple other exceptions do this here, so I won\u0027t ask for it to be done here.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"68ae767ad7a8336d3ef44f0ec8a41409602c3d75","unresolved":false,"context_lines":[{"line_number":465,"context_line":"class IncompleteData(ImportTaskError):"},{"line_number":466,"context_line":"    message \u003d _(\"The download is incomplete.\")"},{"line_number":467,"context_line":""},{"line_number":468,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":469,"context_line":"        self.path \u003d kwargs.get(\u0027path\u0027, None)"},{"line_number":470,"context_line":"        super(IncompleteData, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_3620c89b","line":470,"range":{"start_line":468,"start_character":0,"end_line":470,"end_character":61},"in_reply_to":"9f560f44_ff15c19c","updated":"2020-09-19 17:09:05.000000000","message":"I\u0027ve removed this class since I now set the path directly in a Task attribute.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"}],"glance/tests/unit/async_/flows/test_web_download.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            self.image_id, self.uri)"},{"line_number":67,"context_line":"        with mock.patch.object(script_utils,"},{"line_number":68,"context_line":"                               \u0027get_image_data_iter\u0027) as mock_iter:"},{"line_number":69,"context_line":"            mock_add.return_value \u003d [\"path\", b\"dddd\"]"},{"line_number":70,"context_line":"            mock_iter.return_value.headers \u003d {}"},{"line_number":71,"context_line":"            web_download_task.execute()"},{"line_number":72,"context_line":"            mock_add.assert_called_once_with(self.image_id,"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_9fd765c1","line":69,"range":{"start_line":69,"start_character":37,"end_line":69,"end_character":52},"updated":"2020-09-16 14:38:37.000000000","message":"This only matters here, but before \"dddd\" was the path being returned, and now it\u0027s \"path\", so maybe changing these to \"path\" and something like we would expect from the store would be the best idea.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"68ae767ad7a8336d3ef44f0ec8a41409602c3d75","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            self.image_id, self.uri)"},{"line_number":67,"context_line":"        with mock.patch.object(script_utils,"},{"line_number":68,"context_line":"                               \u0027get_image_data_iter\u0027) as mock_iter:"},{"line_number":69,"context_line":"            mock_add.return_value \u003d [\"path\", b\"dddd\"]"},{"line_number":70,"context_line":"            mock_iter.return_value.headers \u003d {}"},{"line_number":71,"context_line":"            web_download_task.execute()"},{"line_number":72,"context_line":"            mock_add.assert_called_once_with(self.image_id,"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_b63338f6","line":69,"range":{"start_line":69,"start_character":37,"end_line":69,"end_character":52},"in_reply_to":"9f560f44_9fd765c1","updated":"2020-09-19 17:09:05.000000000","message":"Done","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                               \u0027get_image_data_iter\u0027) as mock_iter:"},{"line_number":69,"context_line":"            mock_add.return_value \u003d [\"path\", b\"dddd\"]"},{"line_number":70,"context_line":"            mock_iter.return_value.headers \u003d {}"},{"line_number":71,"context_line":"            web_download_task.execute()"},{"line_number":72,"context_line":"            mock_add.assert_called_once_with(self.image_id,"},{"line_number":73,"context_line":"                                             mock_iter.return_value, 0)"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_bf4989b8","line":71,"updated":"2020-09-16 14:38:37.000000000","message":"You should assert that you get back the path you expect here, which comes from the return value you\u0027re setting above.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"68ae767ad7a8336d3ef44f0ec8a41409602c3d75","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                               \u0027get_image_data_iter\u0027) as mock_iter:"},{"line_number":69,"context_line":"            mock_add.return_value \u003d [\"path\", b\"dddd\"]"},{"line_number":70,"context_line":"            mock_iter.return_value.headers \u003d {}"},{"line_number":71,"context_line":"            web_download_task.execute()"},{"line_number":72,"context_line":"            mock_add.assert_called_once_with(self.image_id,"},{"line_number":73,"context_line":"                                             mock_iter.return_value, 0)"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_962ef489","line":71,"in_reply_to":"9f560f44_bf4989b8","updated":"2020-09-19 17:09:05.000000000","message":"Done","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"01a74cf4d1cf44b5b148c62abb567e2a2846d745","unresolved":false,"context_lines":[{"line_number":83,"context_line":"            mock_add.return_value \u003d [\"path\", 3]"},{"line_number":84,"context_line":"            self.assertRaises("},{"line_number":85,"context_line":"                glance.common.exception.IncompleteData,"},{"line_number":86,"context_line":"                web_download_task.execute)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    def test_web_download_node_staging_uri_is_none(self):"},{"line_number":89,"context_line":"        self.config(node_staging_uri\u003dNone)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_fff1416c","line":86,"updated":"2020-09-16 14:38:37.000000000","message":"You\u0027re missing the case where content-length *is* provided and it matches.","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":30054,"name":"Grégoire Unbekandt","email":"gregoire.unbekandt@gmail.com","username":"yebinama"},"change_message_id":"68ae767ad7a8336d3ef44f0ec8a41409602c3d75","unresolved":false,"context_lines":[{"line_number":83,"context_line":"            mock_add.return_value \u003d [\"path\", 3]"},{"line_number":84,"context_line":"            self.assertRaises("},{"line_number":85,"context_line":"                glance.common.exception.IncompleteData,"},{"line_number":86,"context_line":"                web_download_task.execute)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    def test_web_download_node_staging_uri_is_none(self):"},{"line_number":89,"context_line":"        self.config(node_staging_uri\u003dNone)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f560f44_f64ad058","line":86,"in_reply_to":"9f560f44_fff1416c","updated":"2020-09-19 17:09:05.000000000","message":"Done","commit_id":"c600b191ccc1f34c406bcff179d8cc9517ac66eb"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"ef252832004396a9e72cd4855a743a9715c345ed","unresolved":false,"context_lines":[{"line_number":79,"context_line":"            self.image_id, self.uri)"},{"line_number":80,"context_line":"        with mock.patch.object(script_utils,"},{"line_number":81,"context_line":"                               \u0027get_image_data_iter\u0027) as mock_iter:"},{"line_number":82,"context_line":"            mock_iter.return_value.headers \u003d {\u0027content-length\u0027: 4}"},{"line_number":83,"context_line":"            mock_add.return_value \u003d [\"path\", 4]"},{"line_number":84,"context_line":"            self.assertEqual(web_download_task.execute(), \"path\")"},{"line_number":85,"context_line":"            mock_add.assert_called_once_with(self.image_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f560f44_3b926459","line":82,"range":{"start_line":82,"start_character":64,"end_line":82,"end_character":66},"updated":"2020-09-21 14:21:12.000000000","message":"In the header itself, it will be a string, not an int, so you should make it a string here to make sure that you\u0027re int()ing it and not choking in a real situation where it\u0027s not an integer.","commit_id":"e261630cc498335528ea7487e47cd34e3908f54a"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"ef252832004396a9e72cd4855a743a9715c345ed","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            self.image_id, self.uri)"},{"line_number":106,"context_line":"        with mock.patch.object(script_utils,"},{"line_number":107,"context_line":"                               \u0027get_image_data_iter\u0027) as mock_iter:"},{"line_number":108,"context_line":"            mock_iter.return_value.headers \u003d {\u0027content-length\u0027: 4}"},{"line_number":109,"context_line":"            mock_add.return_value \u003d [\"path\", 3]"},{"line_number":110,"context_line":"            self.assertRaises("},{"line_number":111,"context_line":"                glance.common.exception.ImportTaskError,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f560f44_bb879412","line":108,"range":{"start_line":108,"start_character":64,"end_line":108,"end_character":65},"updated":"2020-09-21 14:21:12.000000000","message":"Same here.","commit_id":"e261630cc498335528ea7487e47cd34e3908f54a"}]}
