)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":15905,"name":"Cao Xuan Hoang","email":"xuanhoangqb@gmail.com","username":"hoangcx"},"change_message_id":"ce61c14ab9a6f0f48bd7184fa25d6a2fbc3c177f","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     jimmygc \u003cguochao@winhong.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-05-23 10:30:35 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Clean /tmp after uload when using glance v2 client"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I0a7267db894e7be4216a346752d299132df9a29a"},{"line_number":10,"context_line":"Closes-Bug: #1689694"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff0f0b1f_2ea8068b","line":7,"range":{"start_line":7,"start_character":17,"end_line":7,"end_character":22},"updated":"2017-05-23 03:42:26.000000000","message":"nit: upload?","commit_id":"abba10b2d0ffbc2d49056582dc6f28f08d081716"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a3641bc83d91de5dc8247fe6a9fbe0ab54eed1a4","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Clean /tmp after upload when using glance v2 client"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When using glance v2 client, it will leave  a upload"},{"line_number":10,"context_line":"tmp file in /tmp folder, which will cause upload error"},{"line_number":11,"context_line":"if its filesystem (in memory) is full."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"ff0f0b1f_e4576326","line":9,"updated":"2017-05-25 20:14:56.000000000","message":"nit: to spaces before \u0027a\u0027\na\u003d\u003e an","commit_id":"92b1e596c6cbe96d9690c6772329250c108cff4c"}],"openstack_dashboard/api/glance.py":[{"author":{"_account_id":23757,"name":"Mateusz Kowalski","email":"mko@redhat.com","username":"makowals"},"change_message_id":"5cd1b347a4e5c7ac53916399465e9ce7b923c7c1","unresolved":false,"context_lines":[{"line_number":469,"context_line":"                    try:"},{"line_number":470,"context_line":"                        os.remove(data.file.name)"},{"line_number":471,"context_line":"                    except Exception as e:"},{"line_number":472,"context_line":"                        filename \u003d str(data.file)"},{"line_number":473,"context_line":"                        if hasattr(data.file, \u0027name\u0027):"},{"line_number":474,"context_line":"                            filename \u003d data.file.name"},{"line_number":475,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f044301_154326b1","line":472,"updated":"2017-05-10 06:46:42.000000000","message":"I would wrap this line with try-catch as it may happen for some reason it\u0027s not possible to str(data.file) ...","commit_id":"9bdfb9ffa1cf98fcf99d5d755bb4d1b9efc29d15"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"bac747e43939f60ef7308db4316ee60182fd335d","unresolved":false,"context_lines":[{"line_number":469,"context_line":"                    try:"},{"line_number":470,"context_line":"                        os.remove(data.file.name)"},{"line_number":471,"context_line":"                    except Exception as e:"},{"line_number":472,"context_line":"                        filename \u003d str(data.file)"},{"line_number":473,"context_line":"                        if hasattr(data.file, \u0027name\u0027):"},{"line_number":474,"context_line":"                            filename \u003d data.file.name"},{"line_number":475,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f044301_e557d757","line":472,"in_reply_to":"3f044301_154326b1","updated":"2017-05-11 01:40:46.000000000","message":"Done","commit_id":"9bdfb9ffa1cf98fcf99d5d755bb4d1b9efc29d15"},{"author":{"_account_id":23757,"name":"Mateusz Kowalski","email":"mko@redhat.com","username":"makowals"},"change_message_id":"5cd1b347a4e5c7ac53916399465e9ce7b923c7c1","unresolved":false,"context_lines":[{"line_number":474,"context_line":"                            filename \u003d data.file.name"},{"line_number":475,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":476,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":477,"context_line":"                                    {\u0027file\u0027: filename, \u0027e\u0027: e})"},{"line_number":478,"context_line":"            thread.start_new_thread(upload, ())"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    return Image(image)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f044301_d57ffedd","line":477,"updated":"2017-05-10 06:46:42.000000000","message":"... and then this line won\u0027t have correctly defined \"filename\". In L470 you are trying to os.remove \"data.file.name\" so maybe we should consider logging it in the same form without any reparsing? In the end it was data.file.name to be removed","commit_id":"9bdfb9ffa1cf98fcf99d5d755bb4d1b9efc29d15"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"bac747e43939f60ef7308db4316ee60182fd335d","unresolved":false,"context_lines":[{"line_number":474,"context_line":"                            filename \u003d data.file.name"},{"line_number":475,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":476,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":477,"context_line":"                                    {\u0027file\u0027: filename, \u0027e\u0027: e})"},{"line_number":478,"context_line":"            thread.start_new_thread(upload, ())"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"    return Image(image)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f044301_c554db55","line":477,"in_reply_to":"3f044301_d57ffedd","updated":"2017-05-11 01:40:46.000000000","message":"Done","commit_id":"9bdfb9ffa1cf98fcf99d5d755bb4d1b9efc29d15"},{"author":{"_account_id":23757,"name":"Mateusz Kowalski","email":"mko@redhat.com","username":"makowals"},"change_message_id":"2c5b38ed01f437acb1902c8c4fecfc45ee5ccc5f","unresolved":false,"context_lines":[{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        if not filename:"},{"line_number":475,"context_line":"                            try:"},{"line_number":476,"context_line":"                                filename \u003d str(data.file)"},{"line_number":477,"context_line":"                            except Exception:"}],"source_content_type":"text/x-python","patch_set":3,"id":"1f013ff3_c22c4849","line":474,"updated":"2017-05-15 14:17:10.000000000","message":"Is this whole \"if\" block even needed ? It\u0027s used only to fill the error message, but the information we want to obtain here is already either in \"request\" or \"data\". I believe it should be possible to do just \"filename \u003d data.xxx\"","commit_id":"17c508c130603121a2c1781a290cd2e01ecb66bb"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"72cddbe842f0a73acc18383023464ac102e7eb9e","unresolved":false,"context_lines":[{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        if not filename:"},{"line_number":475,"context_line":"                            try:"},{"line_number":476,"context_line":"                                filename \u003d str(data.file)"},{"line_number":477,"context_line":"                            except Exception:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ff0f0b1f_982cfcac","line":474,"in_reply_to":"1f013ff3_c22c4849","updated":"2017-05-23 02:31:10.000000000","message":"Yes,you are right.Done","commit_id":"17c508c130603121a2c1781a290cd2e01ecb66bb"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a3641bc83d91de5dc8247fe6a9fbe0ab54eed1a4","unresolved":false,"context_lines":[{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff0f0b1f_a4184b84","line":473,"updated":"2017-05-25 20:14:56.000000000","message":"Can we catch less general exceptions here?","commit_id":"92b1e596c6cbe96d9690c6772329250c108cff4c"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"a7a9b3ffc8d4eb8f523cbd9699e1ce9e98e8436d","unresolved":false,"context_lines":[{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff0f0b1f_510c8841","line":473,"in_reply_to":"ff0f0b1f_a4184b84","updated":"2017-05-26 03:09:15.000000000","message":"This catch any exception, if you don\u0027t catch them all, they may cause horizon to crash if the deletion fails.\nThe exception of this deletion is no fatal, so it is just fine to catch all exceptions.","commit_id":"92b1e596c6cbe96d9690c6772329250c108cff4c"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a3641bc83d91de5dc8247fe6a9fbe0ab54eed1a4","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff0f0b1f_443e0fdb","line":475,"updated":"2017-05-25 20:14:56.000000000","message":"why do we use data.file as a file name here and data.file.name few line above?","commit_id":"92b1e596c6cbe96d9690c6772329250c108cff4c"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"a7a9b3ffc8d4eb8f523cbd9699e1ce9e98e8436d","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff0f0b1f_916b40f0","line":475,"in_reply_to":"ff0f0b1f_443e0fdb","updated":"2017-05-26 03:09:15.000000000","message":"This means to at lease get something to log if data.file.name does not exists.","commit_id":"92b1e596c6cbe96d9690c6772329250c108cff4c"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"7e546ae45f98bc50fcefecc1b3da130c5573ac54","unresolved":false,"context_lines":[{"line_number":464,"context_line":"        else:"},{"line_number":465,"context_line":"            def upload():"},{"line_number":466,"context_line":"                try:"},{"line_number":467,"context_line":"                    return glanceclient(request).images.upload(image.id, data)"},{"line_number":468,"context_line":"                finally:"},{"line_number":469,"context_line":"                    filename \u003d None"},{"line_number":470,"context_line":"                    try:"}],"source_content_type":"text/x-python","patch_set":6,"id":"df140735_bb82934e","line":467,"updated":"2017-05-29 23:48:40.000000000","message":"One more question: Is it a bug in glanceclient? or should a caller handle this kind of error? I would like to know this is a workaround or a responsibility of a caller.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"6ddf13f4b15deb1ee85b6d8920e5e75ec578a0d1","unresolved":false,"context_lines":[{"line_number":464,"context_line":"        else:"},{"line_number":465,"context_line":"            def upload():"},{"line_number":466,"context_line":"                try:"},{"line_number":467,"context_line":"                    return glanceclient(request).images.upload(image.id, data)"},{"line_number":468,"context_line":"                finally:"},{"line_number":469,"context_line":"                    filename \u003d None"},{"line_number":470,"context_line":"                    try:"}],"source_content_type":"text/x-python","patch_set":6,"id":"df140735_9522dca3","line":467,"in_reply_to":"df140735_bb82934e","updated":"2017-05-31 03:03:05.000000000","message":"This is not a bug of glanceclient, because it is weird if you upload a image and glanceclient automatically remove it.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"95338ba0239547e59e24981e5eb9f5ce26828acd","unresolved":false,"context_lines":[{"line_number":467,"context_line":"                    return glanceclient(request).images.upload(image.id, data)"},{"line_number":468,"context_line":"                finally:"},{"line_number":469,"context_line":"                    filename \u003d None"},{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"}],"source_content_type":"text/x-python","patch_set":6,"id":"ff0f0b1f_c28d642b","line":473,"range":{"start_line":470,"start_character":20,"end_line":473,"end_character":42},"updated":"2017-05-26 06:29:47.000000000","message":"Could you split L.471 and 472 into separate try-except? It is because these do different thing and different exception could be raised.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"6ddf13f4b15deb1ee85b6d8920e5e75ec578a0d1","unresolved":false,"context_lines":[{"line_number":467,"context_line":"                    return glanceclient(request).images.upload(image.id, data)"},{"line_number":468,"context_line":"                finally:"},{"line_number":469,"context_line":"                    filename \u003d None"},{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"}],"source_content_type":"text/x-python","patch_set":6,"id":"df140735_1536cce7","line":473,"range":{"start_line":470,"start_character":20,"end_line":473,"end_character":42},"in_reply_to":"df140735_1b9bbfc9","updated":"2017-05-31 03:03:05.000000000","message":"I am not so sure to, so I catch all the exception to make sure that it always works.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"7e546ae45f98bc50fcefecc1b3da130c5573ac54","unresolved":false,"context_lines":[{"line_number":467,"context_line":"                    return glanceclient(request).images.upload(image.id, data)"},{"line_number":468,"context_line":"                finally:"},{"line_number":469,"context_line":"                    filename \u003d None"},{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"}],"source_content_type":"text/x-python","patch_set":6,"id":"df140735_1b9bbfc9","line":473,"range":{"start_line":470,"start_character":20,"end_line":473,"end_character":42},"in_reply_to":"ff0f0b1f_339fb8b5","updated":"2017-05-29 23:48:40.000000000","message":"Honestly I do not know whether L.471 raises an error or it always succeeds.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"2e641cf5e6c3d7ee8da17d76e6bb62f0f05b34c0","unresolved":false,"context_lines":[{"line_number":467,"context_line":"                    return glanceclient(request).images.upload(image.id, data)"},{"line_number":468,"context_line":"                finally:"},{"line_number":469,"context_line":"                    filename \u003d None"},{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"}],"source_content_type":"text/x-python","patch_set":6,"id":"ff0f0b1f_339fb8b5","line":473,"range":{"start_line":470,"start_character":20,"end_line":473,"end_character":42},"in_reply_to":"ff0f0b1f_c28d642b","updated":"2017-05-27 03:22:04.000000000","message":"Failing to get the file name also cause failure of removing the file. I think it\u0027s fine to log in the some line.\nI don\u0027t know the exception class raised by a invalid filename.\nCan you give some suggestion?","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"95338ba0239547e59e24981e5eb9f5ce26828acd","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"ff0f0b1f_82976c3b","line":475,"range":{"start_line":475,"start_character":28,"end_line":475,"end_character":53},"updated":"2017-05-26 06:29:47.000000000","message":"Is it a fallback for L.471?\nIf so, how about something like below?\n\n try:\n    filename \u003d str(data.file.name)\n except Exception:\n    filename \u003d str(data.file)  # I am not sure it is what you expect\n    # Can this raise an exception again?\n try:\n    os.remove(filename)\n except Exception:\n    pass\n\nNo logging is covered in the above sample logic, but I hope it helps you.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"6ddf13f4b15deb1ee85b6d8920e5e75ec578a0d1","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"df140735_ea02530b","line":475,"range":{"start_line":475,"start_character":28,"end_line":475,"end_character":53},"in_reply_to":"df140735_96a57db8","updated":"2017-05-31 03:03:05.000000000","message":"data.file is just a fallback only for log output and not used in other place. data.file.name is the one that I need.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"2e641cf5e6c3d7ee8da17d76e6bb62f0f05b34c0","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"ff0f0b1f_933444e0","line":475,"range":{"start_line":475,"start_character":28,"end_line":475,"end_character":53},"in_reply_to":"ff0f0b1f_82976c3b","updated":"2017-05-27 03:22:04.000000000","message":"I don\u0027t think you can get file name from str(data.file), because it will return something like \"\u003copen file \u0027XXX\u0027, mode \u0027w\u0027 at 0xXXXXXXXX\u003e\", not the path of the file.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"7e546ae45f98bc50fcefecc1b3da130c5573ac54","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except Exception as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"df140735_96a57db8","line":475,"range":{"start_line":475,"start_character":28,"end_line":475,"end_character":53},"in_reply_to":"ff0f0b1f_933444e0","updated":"2017-05-29 23:48:40.000000000","message":"You use \u0027filename\u0027 in several meanings. This confuses developers at least me.\n\nIf os, using \u0027filename\u0027 as a filename at L.475 is really confusing for developer. What is your intention? Do you want to log file info based on data.file and use data.file.name as a fallback? \n\nAt least using \u0027filename\u0027 here is confusing.","commit_id":"ad9ae1f028e68247c7e6d203766afe96bb77bdbe"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"2e4691794540d40d73f4365d55e7ede2155cc63c","unresolved":false,"context_lines":[{"line_number":450,"context_line":"            return ExternallyUploadedImage(image, request)"},{"line_number":451,"context_line":"        elif isinstance(data, TemporaryUploadedFile):"},{"line_number":452,"context_line":"            # Hack to fool Django, so we can keep file open in the new thread."},{"line_number":453,"context_line":"            data.file.close_called \u003d True"},{"line_number":454,"context_line":"        elif isinstance(data, InMemoryUploadedFile):"},{"line_number":455,"context_line":"            # Clone a new file for InMemeoryUploadedFile."},{"line_number":456,"context_line":"            # Because the old one will be closed by Django."}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_75707b73","line":453,"updated":"2017-06-12 12:44:22.000000000","message":"I think this is the problem you are trying to fix.","commit_id":"186c084c7d3902ba4dbe6d028e31cfe009d9bf95"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"2e4691794540d40d73f4365d55e7ede2155cc63c","unresolved":false,"context_lines":[{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except Exception:"},{"line_number":477,"context_line":"                            pass"},{"line_number":478,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":479,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":480,"context_line":"                                    {\u0027file\u0027: filename, \u0027Exception\u0027: e})"}],"source_content_type":"text/x-python","patch_set":7,"id":"7f231b9d_35bc4304","line":477,"updated":"2017-06-12 12:44:22.000000000","message":"Instead of catching all the possible exception, can you catch just the SystemError and then check if it\u0027s the error you expected using the errno module, otherwise re-raise it?","commit_id":"186c084c7d3902ba4dbe6d028e31cfe009d9bf95"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"497f6260064035f9edac3b5ecd426eb564a16fe8","unresolved":false,"context_lines":[{"line_number":470,"context_line":"                    try:"},{"line_number":471,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":472,"context_line":"                        os.remove(filename)"},{"line_number":473,"context_line":"                    except (IOError, OSError) as e:"},{"line_number":474,"context_line":"                        try:"},{"line_number":475,"context_line":"                            filename \u003d str(data.file)"},{"line_number":476,"context_line":"                        except IOError:"}],"source_content_type":"text/x-python","patch_set":8,"id":"7f231b9d_94177952","line":473,"updated":"2017-06-13 08:22:10.000000000","message":"Can you add checking of errno, so that we only catch the bugs we expect?","commit_id":"7e9c6e885a84fd15abdcacc713e7258d1075a04f"},{"author":{"_account_id":15905,"name":"Cao Xuan Hoang","email":"xuanhoangqb@gmail.com","username":"hoangcx"},"change_message_id":"969b301d1e928533023fdfb392c3765aedeff9bd","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                        filename \u003d str(data.file.name)"},{"line_number":473,"context_line":"                        os.remove(filename)"},{"line_number":474,"context_line":"                    except (IOError, OSError) as e:"},{"line_number":475,"context_line":"                        if e.errno not in [errno.EPERM, errno.ENOENT, errno.EIO, errno.EBADF,"},{"line_number":476,"context_line":"                            errno.EACCES, errno.EBUSY, errno.EISDIR, errno.ENFILE, errno.EMFILE,"},{"line_number":477,"context_line":"                            errno.EROFS, errno.ENAMETOOLONG]:"},{"line_number":478,"context_line":"                            raise"},{"line_number":479,"context_line":"                        try:"},{"line_number":480,"context_line":"                            filename \u003d str(data.file)"},{"line_number":481,"context_line":"                        except IOError:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7f231b9d_5355541c","line":478,"range":{"start_line":475,"start_character":0,"end_line":478,"end_character":33},"updated":"2017-06-14 04:25:52.000000000","message":"Should be:\n\n                        if e.errno not in [errno.EPERM, errno.ENOENT,\n                                           errno.EIO, errno.EBADF,\n                                           errno.EACCES, errno.EBUSY,\n                                           errno.EROFS, errno.ENAMETOOLONG]:\n                            raise","commit_id":"95a21bac971ccb3c483cfcafcd6452abd85f2b36"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"686456b9cff744460bc72d9d0cc1d8678436cdda","unresolved":false,"context_lines":[{"line_number":475,"context_line":"                        if e.errno not in [errno.EPERM, errno.ENOENT,"},{"line_number":476,"context_line":"                                           errno.EIO, errno.EBADF,"},{"line_number":477,"context_line":"                                           errno.EACCES, errno.EBUSY,"},{"line_number":478,"context_line":"                                           errno.EROFS, errno.ENAMETOOLONG]:"},{"line_number":479,"context_line":"                            raise"},{"line_number":480,"context_line":"                        try:"},{"line_number":481,"context_line":"                            filename \u003d str(data.file)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7f231b9d_7fcc9160","line":478,"updated":"2017-06-14 07:34:33.000000000","message":"I\u0027m pretty sure we *don\u0027t* want to catch EIO, EBADF, EBUSY, EROFS or ENAMETOOLONG -- those are errors that are fatal and should crash the application when they happen, and not be ignored. That;s the whole point of checking the errno.\n\nAlso, what\u0027s the point of catching IOError, if you are going to e-raise it instantly, because it doesn\u0027t have errno defined?","commit_id":"a86c59235e6334e1f785316cc46401cb96432361"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"f063282fce523e87c9dd7f4081b2a078001c8dc0","unresolved":false,"context_lines":[{"line_number":475,"context_line":"                        if e.errno not in [errno.EPERM, errno.ENOENT,"},{"line_number":476,"context_line":"                                           errno.EIO, errno.EBADF,"},{"line_number":477,"context_line":"                                           errno.EACCES, errno.EBUSY,"},{"line_number":478,"context_line":"                                           errno.EROFS, errno.ENAMETOOLONG]:"},{"line_number":479,"context_line":"                            raise"},{"line_number":480,"context_line":"                        try:"},{"line_number":481,"context_line":"                            filename \u003d str(data.file)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7f231b9d_a50e9638","line":478,"in_reply_to":"7f231b9d_5ff43586","updated":"2017-06-14 08:51:13.000000000","message":"Done","commit_id":"a86c59235e6334e1f785316cc46401cb96432361"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"1e536120431ad7baa4cf021bad6f38c81d539d98","unresolved":false,"context_lines":[{"line_number":475,"context_line":"                        if e.errno not in [errno.EPERM, errno.ENOENT,"},{"line_number":476,"context_line":"                                           errno.EIO, errno.EBADF,"},{"line_number":477,"context_line":"                                           errno.EACCES, errno.EBUSY,"},{"line_number":478,"context_line":"                                           errno.EROFS, errno.ENAMETOOLONG]:"},{"line_number":479,"context_line":"                            raise"},{"line_number":480,"context_line":"                        try:"},{"line_number":481,"context_line":"                            filename \u003d str(data.file)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7f231b9d_5ff43586","line":478,"in_reply_to":"7f231b9d_7fcc9160","updated":"2017-06-14 07:35:35.000000000","message":"I also don\u0027t think you really expect ENOENT here -- if the file disappeared, then something went wrong.","commit_id":"a86c59235e6334e1f785316cc46401cb96432361"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"e5b5bdc827650b222f1cee32e131dee0221b3b4d","unresolved":false,"context_lines":[{"line_number":477,"context_line":"                        try:"},{"line_number":478,"context_line":"                            filename \u003d str(data.file)"},{"line_number":479,"context_line":"                        except IOError:"},{"line_number":480,"context_line":"                            pass"},{"line_number":481,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":482,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":483,"context_line":"                                    {\u0027file\u0027: filename, \u0027Exception\u0027: e})"}],"source_content_type":"text/x-python","patch_set":12,"id":"7f231b9d_d70ee98b","line":480,"updated":"2017-06-14 09:16:10.000000000","message":"Have you actually tested this?","commit_id":"6f5ca85662be5f467babc79df22abcd920de1cd2"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"84617f0a1b3c3ec9c586eee643d68cf8df7d808c","unresolved":false,"context_lines":[{"line_number":477,"context_line":"                        try:"},{"line_number":478,"context_line":"                            filename \u003d str(data.file)"},{"line_number":479,"context_line":"                        except IOError:"},{"line_number":480,"context_line":"                            pass"},{"line_number":481,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":482,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":483,"context_line":"                                    {\u0027file\u0027: filename, \u0027Exception\u0027: e})"}],"source_content_type":"text/x-python","patch_set":12,"id":"df3967d1_53556ac5","line":480,"in_reply_to":"1f1a1f67_c4ff23a9","updated":"2017-08-02 10:03:31.000000000","message":"I\u0027m asking, because the way you are doing it here doesn\u0027t make any sense. Perhaps it would be better to take a step back, think about what errors you actually want to catch and what you want to do when they happen, and then write this code properly?","commit_id":"6f5ca85662be5f467babc79df22abcd920de1cd2"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"8338d27375ec9cc65a54ad9a389cd76931d9f987","unresolved":false,"context_lines":[{"line_number":477,"context_line":"                        try:"},{"line_number":478,"context_line":"                            filename \u003d str(data.file)"},{"line_number":479,"context_line":"                        except IOError:"},{"line_number":480,"context_line":"                            pass"},{"line_number":481,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":482,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":483,"context_line":"                                    {\u0027file\u0027: filename, \u0027Exception\u0027: e})"}],"source_content_type":"text/x-python","patch_set":12,"id":"1f1a1f67_c4ff23a9","line":480,"in_reply_to":"3f1d235d_3ff1f201","updated":"2017-07-18 03:36:53.000000000","message":"Yes, it works well without these try-excepts, but I add them according to the reviewers\u0027 suggestions.","commit_id":"6f5ca85662be5f467babc79df22abcd920de1cd2"},{"author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"change_message_id":"aaef268ce24142a4aba4d319d2f8df6bac39e7eb","unresolved":false,"context_lines":[{"line_number":477,"context_line":"                        try:"},{"line_number":478,"context_line":"                            filename \u003d str(data.file)"},{"line_number":479,"context_line":"                        except IOError:"},{"line_number":480,"context_line":"                            pass"},{"line_number":481,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":482,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":483,"context_line":"                                    {\u0027file\u0027: filename, \u0027Exception\u0027: e})"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_3ff1f201","line":480,"in_reply_to":"3f1d235d_914fe069","updated":"2017-07-07 08:43:49.000000000","message":"Does it also work equally well without the try-excepts?","commit_id":"6f5ca85662be5f467babc79df22abcd920de1cd2"},{"author":{"_account_id":24013,"name":"jimmygc","email":"guochao@winhong.com","username":"jimmygc"},"change_message_id":"709e118b2e06584d31c7ba3cd62b3e237999b228","unresolved":false,"context_lines":[{"line_number":477,"context_line":"                        try:"},{"line_number":478,"context_line":"                            filename \u003d str(data.file)"},{"line_number":479,"context_line":"                        except IOError:"},{"line_number":480,"context_line":"                            pass"},{"line_number":481,"context_line":"                        LOG.warning(\u0027Failed to remove temporary image file \u0027"},{"line_number":482,"context_line":"                                    \u0027%(file)s (%(e)s)\u0027,"},{"line_number":483,"context_line":"                                    {\u0027file\u0027: filename, \u0027Exception\u0027: e})"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_914fe069","line":480,"in_reply_to":"7f231b9d_d70ee98b","updated":"2017-07-07 05:32:42.000000000","message":"I tested this on my own Kolla environment. It works fine.","commit_id":"6f5ca85662be5f467babc79df22abcd920de1cd2"}]}
