)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"0b94265ed21a2e5a1fc60109f1f641679a1da07a","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     ls1175 \u003cliusheng@huawei.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2013-12-23 17:57:03 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fix the glance log incorectly when creating image"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When using \"nova image-create my_server_id name\" to create an image, the"},{"line_number":10,"context_line":"glance api log image id incorectly in method create()."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"AAAATn%2F8pWc%3D","line":7,"updated":"2013-12-23 19:22:47.000000000","message":"typo: incorrectly\nalso maybe rephrase: \"Fix the incorrect log message when creating images\"","commit_id":"b069dd9c790b0c4b0f4b8497d477e2436d15855e"},{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"0b94265ed21a2e5a1fc60109f1f641679a1da07a","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix the glance log incorectly when creating image"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When using \"nova image-create my_server_id name\" to create an image, the"},{"line_number":10,"context_line":"glance api log image id incorectly in method create()."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I938279526ed5adf5b95ec5f67e78c6465f890898"},{"line_number":13,"context_line":"Closes-bug: #1263647"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"AAAATn%2F8pVs%3D","line":10,"updated":"2013-12-23 19:22:47.000000000","message":"the glance api log image id is incorrect in the method create().","commit_id":"b069dd9c790b0c4b0f4b8497d477e2436d15855e"}],"glance/registry/api/v1/images.py":[{"author":{"_account_id":8759,"name":"Arnaud Legendre","email":"arnaudleg@gmail.com","username":"arnaud"},"change_message_id":"0b94265ed21a2e5a1fc60109f1f641679a1da07a","unresolved":false,"context_lines":[{"line_number":389,"context_line":"        try:"},{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % \\"},{"line_number":393,"context_line":"                {\u0027id\u0027: image_data.get(\u0027id\u0027)}"},{"line_number":394,"context_line":"            LOG.info(msg)"},{"line_number":395,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F8pWI%3D","line":392,"updated":"2013-12-23 19:22:47.000000000","message":"Could you use parenthesis instead of backslashes\nmsg \u003d (_(\"Successfully created image %(id)s\") % {\u0027id\u0027: image_data.get(\u0027id\u0027)})","commit_id":"b069dd9c790b0c4b0f4b8497d477e2436d15855e"},{"author":{"_account_id":9520,"name":"David Koo (koofoss)","email":"david.koo@huawei.com","username":"koofoss"},"change_message_id":"c94adec208f78a7269045e4e48724bd1bc55010a","unresolved":false,"context_lines":[{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d (_(\"Successfully created image %(id)s\") %"},{"line_number":393,"context_line":"                   {\u0027id\u0027: image_data.get(\u0027id\u0027)})"},{"line_number":394,"context_line":"            LOG.info(msg)"},{"line_number":395,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":396,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F8ldE%3D","line":393,"updated":"2013-12-25 02:00:44.000000000","message":"Since you\u0027re not returning a default value if \u0027id\u0027 is not in \u0027image_data\u0027 why not just:\n\n    {\u0027id\u0027: image_data[\u0027id\u0027]}\n\n?\n\nFor that matter, why not just use image_data instead of constructing another dictionary - the key is already in there?\n\n    msg \u003d _(\"Successfully created image %(id)s\") % image_data","commit_id":"ac45946285b4958d26c44e942cf6e9d3e6fb050c"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"0be49596ad9f54d888439dd8239225aa5250725a","unresolved":false,"context_lines":[{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d (_(\"Successfully created image %(id)s\") %"},{"line_number":393,"context_line":"                   {\u0027id\u0027: image_data.get(\u0027id\u0027)})"},{"line_number":394,"context_line":"            LOG.info(msg)"},{"line_number":395,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":396,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAT3%2F%2F9yk%3D","line":393,"in_reply_to":"AAAATn%2F8ldE%3D","updated":"2013-12-26 06:42:25.000000000","message":"I think the 2nd suggestion is a bad idea.","commit_id":"ac45946285b4958d26c44e942cf6e9d3e6fb050c"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"552e514fc493bb3f009ecf97d04054617fffe1a0","unresolved":false,"context_lines":[{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d (_(\"Successfully created image %(id)s\") %"},{"line_number":393,"context_line":"                   {\u0027id\u0027: image_data.get(\u0027id\u0027)})"},{"line_number":394,"context_line":"            LOG.info(msg)"},{"line_number":395,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":396,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F8lbY%3D","line":393,"in_reply_to":"AAAATn%2F8ldE%3D","updated":"2014-01-15 10:02:45.000000000","message":"Thank you,your idea is very reasonable","commit_id":"ac45946285b4958d26c44e942cf6e9d3e6fb050c"},{"author":{"_account_id":6676,"name":"zqfan","email":"aji.zqfan@gmail.com","username":"aji-zqfan"},"change_message_id":"bf95680f47b2db209dd778b9c255ac62cab7eb3a","unresolved":false,"context_lines":[{"line_number":389,"context_line":"        try:"},{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":393,"context_line":"            LOG.info(msg)"},{"line_number":394,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":395,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAT3%2F%2F%2F9c%3D","line":392,"updated":"2013-12-25 05:36:07.000000000","message":"-1: dictional string format requires dict object argument, which means you should remove (id) or change to \"%(data)\" % {\u0027data\u0027: image_data}\n\nHowever, I think the id is enough for the message, because it is a succussful creation, which means we can query it by id to get more info via glance api, no need to log redundant data. This is an optional opinion.","commit_id":"2a303e201ddcc39c26258b3b07bba7a7f3af0b99"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"ee8dd23496675d2bdd92d5f2cc702b1aa71e5124","unresolved":false,"context_lines":[{"line_number":389,"context_line":"        try:"},{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":393,"context_line":"            LOG.info(msg)"},{"line_number":394,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":395,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAT3%2F%2F9yE%3D","line":392,"in_reply_to":"AAAAT3%2F%2F%2F9c%3D","updated":"2013-12-26 06:45:42.000000000","message":"+1 for zhiqiang\u0027s comment. It\u0027s a very simple fix, but the ps3 is confusing me. I think the initial fix is straightforward and I\u0027m going to plus my +2 if there is a unit test associated. Thanks.","commit_id":"2a303e201ddcc39c26258b3b07bba7a7f3af0b99"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"7f67b67677c8d4201b198c6b7fd452cdbcce5309","unresolved":false,"context_lines":[{"line_number":389,"context_line":"        try:"},{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":393,"context_line":"            LOG.info(msg)"},{"line_number":394,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":395,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAT3%2F%2F68M%3D","line":392,"in_reply_to":"AAAAT3%2F%2F9j4%3D","updated":"2014-01-15 10:04:39.000000000","message":"@ZhiQiang Fan, the image id can be specified when using glance api to create a image. So,here the image_id got from input parameter \"body\" is None,and ,if image id is None, code\n\"image_data \u003d self.db_api.image_create(req.context, image_data)\" will generate an uuid as image id.","commit_id":"2a303e201ddcc39c26258b3b07bba7a7f3af0b99"},{"author":{"_account_id":6676,"name":"zqfan","email":"aji.zqfan@gmail.com","username":"aji-zqfan"},"change_message_id":"a853e954b5bfeb88f0f24f4789958282c3ce63ae","unresolved":false,"context_lines":[{"line_number":389,"context_line":"        try:"},{"line_number":390,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":391,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":392,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":393,"context_line":"            LOG.info(msg)"},{"line_number":394,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":395,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAT3%2F%2F9j4%3D","line":392,"in_reply_to":"AAAAT3%2F%2F9yE%3D","updated":"2013-12-26 08:34:17.000000000","message":"Oh, I didn\u0027t notice that.\n\nPatch set 1 is good, but the escape back slash should be removed.\n\nps: @Fei Long Wang, sorry I\u0027m not familiar with glance, so please clarify that will api create and change the image\u0027s id? if the image id is not changed, why should use image_data.get(\u0027id\u0027), if it does change id, how to explain such behavior?","commit_id":"2a303e201ddcc39c26258b3b07bba7a7f3af0b99"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"772bc122db1ea7c86a03054e2a01902a24921cfe","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F%2FT3o%3D","line":390,"updated":"2014-01-15 07:11:31.000000000","message":"I think the comments in https://review.openstack.org/#/c/63700/3/glance/registry/api/v1/images.py is still valuable.","commit_id":"e2964500d9d6d5dce9de03ab65258d8129751af0"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"f99be905d1b2911e69cfa9ded354ebbfcf6a1d3d","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FTPA%3D","line":390,"updated":"2014-01-15 10:09:58.000000000","message":"my opinion is following since IMO it will better if we don\u0027t assume db api return a dict object but model object.\n\n    msg \u003d _(\"Successfully created image %s\") % image_data.get(\u0027id\u0027)","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"caf069e3d78400a8b8e3408162f34502069896ab","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FNws%3D","line":390,"in_reply_to":"AAAAUH%2F%2FN5w%3D","updated":"2014-01-16 09:46:42.000000000","message":"@Zhi Yan Liu,thank you.First,here the image_data is type of dict(dict()).image_data has 1 elment(key is \"image\"), and the inner dict include the image info (has key \"id\"). So,we cannot use % image_data to get image id.\n\nSecond, I haven\u0027t fond a example to test one log message is correct or not in /glance/tests/unit/v1/test_registry_api.py. I don\u0027t know how to get the log message of this unittest method.\nI have tried and consulted other unittest modules. like:\n        def fake_log_info(msg):\n            if \u0027Successfully created image \u0027 \\\n               \u00270564c64c-3545-4e34-abfb-9d18e5f2f2f9\u0027 in msg:\n                self.log_image_id \u003d True\n        self.stubs.Set(rserver.images.LOG, \u0027info\u0027, fake_log_info)\n\nBut,unfortunately.it run faild!\n\nBest regards","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"b8b0f35577bc9697a61a775bd5bd5ce6d59b673e","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FNlw%3D","line":390,"in_reply_to":"AAAAUH%2F%2FNws%3D","updated":"2014-01-16 10:21:19.000000000","message":"Oh, response so fast this time :)\n\nNot sure you noticed my above comments has a change on: \"image_data \u003d make_image_dict(image_data)\", so \"image_data\" var will just a flat dict object. (that\u0027s just the reason why we construct a nested image_data var as dict(dict()) )\n\nAnd I think your current implementation in https://review.openstack.org/#/c/63700/7/glance/tests/unit/v1/test_registry_api.py is good. Isn\u0027t it?\n\nthanks","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"5a890a20c37a0e16795fd861e774492d87f10b70","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FN5w%3D","line":390,"in_reply_to":"AAAAUH%2F%2FOTk%3D","updated":"2014-01-16 09:18:11.000000000","message":"@liusheng, thanks for you sharing thoughts with me.\n\nFirst, your approach it\u0027s better to me, I have only one small thing, what about this, IMO it\u0027s more clear:\n\n            image_data \u003d make_image_dict(image_data)\n            msg \u003d _(\"Successfully created image %(id)s\") % image_data\n\nSecond, may I know what\u0027s blocker/issue you meet in the unittest?","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"3edbf93fea854abbb7c152376808053b51a9d43d","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FOTk%3D","line":390,"in_reply_to":"AAAAUH%2F%2FRps%3D","updated":"2014-01-16 07:43:31.000000000","message":"thanks for your comments, I think you are right!, and if the db api return a model object, we can only use \".\" operator to get its attribut.\nTo handle both the situations, I have modify the codes like this,and I have tested it OK:\n try:\n            image_data \u003d _normalize_image_location_for_db(image_data)\n            image_data \u003d self.db_api.image_create(req.context, image_data)\n            image_data \u003d dict(image\u003dmake_image_dict(image_data))\n            msg \u003d _(\"Successfully created image %(id)s\") % image_data[\u0027image\u0027]\n            LOG.info(msg)\n            return image_data\n        except exception.Duplicate:\n\nBut,here,I am sorry, I haven\u0027t find the right way to Implement  the unittest about log message. \n\ncould you give me any suggestions? \n\nBest regards","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"530db550f20ce619eddefbb49b193c301752a036","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FRps%3D","line":390,"in_reply_to":"AAAAUH%2F%2FTEQ%3D","updated":"2014-01-15 15:53:04.000000000","message":"Fist I\u0027d like to know is there a limitation for db driver implementation to require all its public interface return a dict (or dict set) bug a model object (or model set)?\n\nTBH maybe my asking is a little overkill, but IMO we\u0027d better don\u0027t *assume* db api always return a dict object but others (maybe model object). In this case, I know under current implementation db_api.image_create() could return a dict since [1], but because the code are stay in different layer (db \u0026 registry service api controll), so I don\u0027t like we assume \"image_data\" variable, in this controller layer here, always be returned as a dict object, this assumption will make this code depends on the implementation of db api side.\n\n[1] https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L124\n\n\nbtw:\n\u003e\u003e\u003e if the image_data is a model object,image_data.get(\u0027id\u0027) will also raise error.\n\nWhat about this:\n\n    msg \u003d _(\"Successfully created image %s\") % image_data[\u0027id\u0027]\n\nLet me know your thoughts pls, thanks.","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"9a0562aea596c8395953b2c85217013a4c0f00cd","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FTEQ%3D","line":390,"in_reply_to":"AAAAUH%2F%2FTGM%3D","updated":"2014-01-15 10:51:33.000000000","message":"if the image_data is a model object,image_data.get(\u0027id\u0027) will also raise error.","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"6d46c0027d614c4124a7102bf424e8b858af794a","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        try:"},{"line_number":388,"context_line":"            image_data \u003d _normalize_image_location_for_db(image_data)"},{"line_number":389,"context_line":"            image_data \u003d self.db_api.image_create(req.context, image_data)"},{"line_number":390,"context_line":"            msg \u003d _(\"Successfully created image %(id)s\") % image_data"},{"line_number":391,"context_line":"            LOG.info(msg)"},{"line_number":392,"context_line":"            return dict(image\u003dmake_image_dict(image_data))"},{"line_number":393,"context_line":"        except exception.Duplicate:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FTGM%3D","line":390,"in_reply_to":"AAAAUH%2F%2FTPA%3D","updated":"2014-01-15 10:46:28.000000000","message":"thank you, I have check the image_create() method in sqlalchemy or simple(the db api glance supported now) API, It return a dict object, the image_data is a dict object. so ,I am not sure if we should consider the situation that  image_data is a model object. if the image_data is a dict object,image_data.get(\u0027id\u0027) will also raise error.","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"}],"glance/tests/unit/v1/test_registry_api.py":[{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"772bc122db1ea7c86a03054e2a01902a24921cfe","unresolved":false,"context_lines":[{"line_number":1293,"context_line":"            if \u0027Successfully created image ls-image-id\u0027 in msg:"},{"line_number":1294,"context_line":"                self.log_image_id \u003d True"},{"line_number":1295,"context_line":""},{"line_number":1296,"context_line":"        self.stubs.Set(rserver.images.LOG, \u0027info\u0027, fake_log_info)"},{"line_number":1297,"context_line":""},{"line_number":1298,"context_line":"        self.assertTrue(self.log_image_id)"},{"line_number":1299,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F%2FT2w%3D","line":1296,"updated":"2014-01-15 07:11:31.000000000","message":"It\u0027s not a big deal to me, but we now trend to use mock in test code.","commit_id":"e2964500d9d6d5dce9de03ab65258d8129751af0"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"b933906d707a27da1b455d42fac21b773ef364ff","unresolved":false,"context_lines":[{"line_number":1285,"context_line":""},{"line_number":1286,"context_line":"        fixture \u003d self.get_minimal_fixture(id\u003d\u0027ls-image-id\u0027)"},{"line_number":1287,"context_line":""},{"line_number":1288,"context_line":"        self.get_api_response_ext(400, content_type\u003d\u0027json\u0027, method\u003d\u0027POST\u0027,"},{"line_number":1289,"context_line":"                                  body\u003djsonutils.dumps(dict(image\u003dfixture)))"},{"line_number":1290,"context_line":"        self.log_image_id \u003d False"},{"line_number":1291,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F%2FTcQ%3D","line":1288,"updated":"2014-01-15 09:29:04.000000000","message":"I\u0027m a little bit confused. You\u0027re expecting the image is created successfully, so why the return code is 400? Please correct me if I missed anything. Thanks.","commit_id":"c255a4a0a8ac7aabe56e39030fdb9e83c009797f"},{"author":{"_account_id":6549,"name":"Zhi Yan Liu","email":"lzy.dev@gmail.com","username":"lzy-dev"},"change_message_id":"856dd34cf91916554a6b25f311b9a3701dc8519d","unresolved":false,"context_lines":[{"line_number":1289,"context_line":"            if \u0027Successfully created image \u0027 \\"},{"line_number":1290,"context_line":"               \u00270564c64c-3545-4e34-abfb-9d18e5f2f2f9\u0027 in msg:"},{"line_number":1291,"context_line":"                self.log_image_id \u003d True"},{"line_number":1292,"context_line":"        self.stubs.Set(rserver.images.LOG, \u0027info\u0027, fake_log_info)"},{"line_number":1293,"context_line":""},{"line_number":1294,"context_line":"        self.get_api_response_ext(200, content_type\u003d\u0027json\u0027, method\u003d\u0027POST\u0027,"},{"line_number":1295,"context_line":"                                  body\u003djsonutils.dumps(dict(image\u003dfixture)))"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAUH%2F%2FBr4%3D","line":1292,"updated":"2014-01-18 15:11:08.000000000","message":"Currently team trend to use mock, but it\u0027s not a big deal to me at here.","commit_id":"c1c72d1694927e4dea1c6f09bd0cea67c2643e7b"},{"author":{"_account_id":9520,"name":"David Koo (koofoss)","email":"david.koo@huawei.com","username":"koofoss"},"change_message_id":"313f79b4e2959a4d6b7ffba58f569f047b020105","unresolved":false,"context_lines":[{"line_number":1289,"context_line":"            if \u0027Successfully created image \u0027 \\"},{"line_number":1290,"context_line":"               \u00270564c64c-3545-4e34-abfb-9d18e5f2f2f9\u0027 in msg:"},{"line_number":1291,"context_line":"                self.log_image_id \u003d True"},{"line_number":1292,"context_line":"        self.stubs.Set(rserver.images.LOG, \u0027info\u0027, fake_log_info)"},{"line_number":1293,"context_line":""},{"line_number":1294,"context_line":"        self.get_api_response_ext(200, content_type\u003d\u0027json\u0027, method\u003d\u0027POST\u0027,"},{"line_number":1295,"context_line":"                                  body\u003djsonutils.dumps(dict(image\u003dfixture)))"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAUH%2F%2B%2BOA%3D","line":1292,"in_reply_to":"AAAAUH%2F%2FA40%3D","updated":"2014-01-20 08:48:05.000000000","message":"How about this:\n\n # Danger: untested code\n import mock\n #...\n def test_create_image_with_image_id_in_log(self):\n     fixture \u003d ...\n    \n     # No need for self.log_image_id, fake_log_info, self.stubs.Set(..)\n\n     LOG.info \u003d mock.MagicMock()  \n     self.get_api_response_ext(...)\n\n     # find what args LOG.info was called with (0 \u003d\u003e the first time, 1 \u003d\u003e second time, ...)\n     log_info_args \u003d tuple(LOG.info.call_args[0])\n     log_msg \u003d \u0027Successfully created image ... \u0027\n     self.assertTrue(log_msg in log_info_args)","commit_id":"c1c72d1694927e4dea1c6f09bd0cea67c2643e7b"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"f264846737d3e92d08d4bffe69712110cc498547","unresolved":false,"context_lines":[{"line_number":1289,"context_line":"            if \u0027Successfully created image \u0027 \\"},{"line_number":1290,"context_line":"               \u00270564c64c-3545-4e34-abfb-9d18e5f2f2f9\u0027 in msg:"},{"line_number":1291,"context_line":"                self.log_image_id \u003d True"},{"line_number":1292,"context_line":"        self.stubs.Set(rserver.images.LOG, \u0027info\u0027, fake_log_info)"},{"line_number":1293,"context_line":""},{"line_number":1294,"context_line":"        self.get_api_response_ext(200, content_type\u003d\u0027json\u0027, method\u003d\u0027POST\u0027,"},{"line_number":1295,"context_line":"                                  body\u003djsonutils.dumps(dict(image\u003dfixture)))"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAUH%2F%2FA40%3D","line":1292,"in_reply_to":"AAAAUH%2F%2FBr4%3D","updated":"2014-01-19 12:20:56.000000000","message":"thank you, I had tried to use mock here,but didn\u0027t find the right way :)","commit_id":"c1c72d1694927e4dea1c6f09bd0cea67c2643e7b"}]}
