)]}'
{"nova/api/openstack/compute/contrib/services.py":[{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"2f423fde18084d98ddf8a4ac0b6c425ec0de4888","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        # NOTE(alex_xu): back-compatible with db layer hard-code admin"},{"line_number":103,"context_line":"        # permission checks"},{"line_number":104,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        try:"},{"line_number":107,"context_line":"            self.host_api.service_delete(context, id)"},{"line_number":108,"context_line":"        except exception.ServiceNotFound:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_7b2c09ac","line":105,"updated":"2015-08-12 12:12:06.000000000","message":"Why not just to verify user input here and do not touch db level?","commit_id":"0f93611f41fc3ac1be04e898a8be477a5fb175a5"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"bf8ac9a72e2a49dd145aa083b32c8875ec39ed8d","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        # NOTE(alex_xu): back-compatible with db layer hard-code admin"},{"line_number":103,"context_line":"        # permission checks"},{"line_number":104,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        try:"},{"line_number":107,"context_line":"            self.host_api.service_delete(context, id)"},{"line_number":108,"context_line":"        except exception.ServiceNotFound:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_59d8301e","line":105,"in_reply_to":"1a4dcd0f_7b2c09ac","updated":"2015-08-12 14:03:04.000000000","message":"I agree it might need more inspection, the following patch may works on it \n\nbut the purpose of the patch is because db layer will convert DB exception into HTTP exception to avoid 500 error","commit_id":"0f93611f41fc3ac1be04e898a8be477a5fb175a5"}],"nova/api/openstack/compute/services.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6dcf3888ef78306e80899122416d22dd59b601cd","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        return action(body, context)"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    @wsgi.response(204)"},{"line_number":161,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":162,"context_line":"    def delete(self, req, id):"},{"line_number":163,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":164,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_36248d5e","line":161,"updated":"2015-08-19 19:32:57.000000000","message":"I guess the stalemate is over this doc:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/doc/source/api_microversion_dev.rst#n68\n\nThat seems overly heavy-handed to me.","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c86e43a840ac4e1414807571f4b916a31a773d4b","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_c79e3d07","line":162,"updated":"2015-08-26 21:13:08.000000000","message":"According to http://git.openstack.org/cgit/openstack/nova/tree/doc/source/api_microversion_dev.rst#n63 this is going to require a microversion change, unless we have another discussion about whether or not we should have that rule for microversion changes when fixing a 500.\n\nThis also covers this scenario:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/doc/source/api_microversion_dev.rst#n138\n\nAnd says a microversion is required.\n\nI\u0027d like sdague\u0027s input.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"5660f5f6d05a58bbf6cbd58d1b6318488d549175","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_c10051ad","line":162,"in_reply_to":"da20952f_35ddd442","updated":"2015-08-27 09:44:57.000000000","message":"@Feodor,\nNice point but m just wondering that if we return 404 for invalid IDs that will be false info which convey that resource is already deleted that\u0027s why it is not found.\n\nIf User input the ID wrongly (copy paste) and if they see 404 then, they will be in impression that it is already deleted which is not case. \nReturning 400 will be correct one to make users to check their input carefully and re request the same.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"5660f5f6d05a58bbf6cbd58d1b6318488d549175","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_c12cd1ad","line":162,"in_reply_to":"da20952f_46ba25e3","updated":"2015-08-27 09:44:57.000000000","message":"@Alex, @Matt,\n\nI think that is only case of PUT/POST request (another is invalid action method) - https://github.com/openstack/nova/blob/master/nova/api/openstack/wsgi.py#L806 \n\n\u003e My another concern is we better find out an common way validation the \u0027id\u0027. As most of nova api didn\u0027t validate that.\n\n+1. That will be really nice instead of fixing it case by case.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"4d106c36f4d050a6b829a3a7ca6d43d576a7c932","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_35ddd442","line":162,"in_reply_to":"da20952f_46ba25e3","updated":"2015-08-27 05:44:40.000000000","message":"@Matt, @Alex, perhaps you didn\u0027t see that i wrote in a root level comment:\n\nI think we can use 404 in that case.\n\nAt the first, delete instance API method returns 404 for malformed ids. So it\u0027ll be consistent to do the same.\n\nAt the second, service id is a surrogate key, auto generated, not user defined, and has no user known structure or restrictions. So the fact that id is invalid is related to Nova internals only, and doesn\u0027t give a user useful details. The only thing which the user can do with the id is to copy it from a response and paste it to a request. If he missed, the same error code should be returned in all cases. (Except when he pastes an id of another existing object, of course)\n\nWhat do you think about this?","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dd234c323826fabe5db207d3091a70dff2d47ee1","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_b6e8e6e3","line":162,"in_reply_to":"da20952f_725a6c85","updated":"2015-08-27 18:04:13.000000000","message":"Per https://review.openstack.org/#/c/217577/ we\u0027re OK with adding 400 w/o a microversion.\n\nI\u0027m personally OK with moving forward on this fix as long as my comment about the unit test is addressed, then I\u0027m +2.  If we want to do more common validation that could be a follow on change IMO.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"d0461cbf4d5ba777e1d2137232ce8cc005a60271","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_52f728d3","line":162,"in_reply_to":"da20952f_c10051ad","updated":"2015-08-27 12:54:53.000000000","message":"\u003e which convey that resource is already deleted that\u0027s why it is not found\n\nGood point. Then Nova should return 400 for all invalid ids, including uuids, which are passed in both as url part and in body.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"6cc046979349c28ec709d63f366b7e67878b7323","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_725a6c85","line":162,"in_reply_to":"da20952f_c12cd1ad","updated":"2015-08-27 13:00:55.000000000","message":"unless we have something like schema for API body check \nuse common check might be hard\n\ne.g in this case, we only accept int for ID\nhowever for volume we use uuid \nthat is ,different API has different expectation to \u0027id\u0027 \n\nwe can do some common functions but we still need \ncheck them one by one","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"4b1cf5bfb1c26d1621256b40b946cd984391bed6","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        return action(body, context)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @wsgi.response(204)"},{"line_number":162,"context_line":"    @extensions.expected_errors((400, 404))"},{"line_number":163,"context_line":"    def delete(self, req, id):"},{"line_number":164,"context_line":"        \"\"\"Deletes the specified service.\"\"\""},{"line_number":165,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_46ba25e3","line":162,"in_reply_to":"da20952f_c79e3d07","updated":"2015-08-27 02:15:20.000000000","message":"@Matt, your keystone case in the guideline reminder me this case:\n\ncurl -g -i -X POST http://hp-pc:8774/v2.1/475f5b67eb9a4f3f8bef785e66912a60/servers -H \"User-Agent: python-novaclient\" -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"X-Auth-Token: e31e43ccbe2c4bc48cd71ff1d1d55b1c\" -d \u0027{abcd}\u0027\nHTTP/1.1 400 Bad Request\nContent-Length: 66\nContent-Type: application/json; charset\u003dUTF-8\nX-Compute-Request-Id: req-8de8a572-8d71-453c-a9e3-2871067277ee\nDate: Thu, 27 Aug 2015 02:21:02 GMT\n\n{\"badRequest\": {\"message\": \"Malformed request body\", \"code\": 400}}\n\n\n\nIf we submit an malformed json body, we will return 400.....400 also is an availble return code for all the API\n\n\nMy another concern is we better find out an common way validation the \u0027id\u0027. As most of nova api didn\u0027t validate that.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"}],"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"81d4a77aacb0b5863261e7e5fe9eeac6ec61e218","unresolved":false,"context_lines":[{"line_number":441,"context_line":""},{"line_number":442,"context_line":"def _service_get(context, service_id, session\u003dNone,"},{"line_number":443,"context_line":"                 use_slave\u003dFalse):"},{"line_number":444,"context_line":"    try:"},{"line_number":445,"context_line":"        query \u003d model_query(context, models.Service, session\u003dsession,"},{"line_number":446,"context_line":"                            use_slave\u003duse_slave).\\"},{"line_number":447,"context_line":"                            filter_by(id\u003dservice_id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_0df672d7","line":444,"updated":"2015-07-06 14:56:46.000000000","message":"can we please add a unit test for this new flow","commit_id":"6bccdf12a2271c671f1a584137faa5a96202b040"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"f9acce8f5992130fcd7435a657258ab306b25cc7","unresolved":false,"context_lines":[{"line_number":441,"context_line":""},{"line_number":442,"context_line":"def _service_get(context, service_id, session\u003dNone,"},{"line_number":443,"context_line":"                 use_slave\u003dFalse):"},{"line_number":444,"context_line":"    try:"},{"line_number":445,"context_line":"        query \u003d model_query(context, models.Service, session\u003dsession,"},{"line_number":446,"context_line":"                            use_slave\u003duse_slave).\\"},{"line_number":447,"context_line":"                            filter_by(id\u003dservice_id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_edd0eef9","line":444,"in_reply_to":"ba3cc151_0df672d7","updated":"2015-07-06 14:59:04.000000000","message":"ok, thanks","commit_id":"6bccdf12a2271c671f1a584137faa5a96202b040"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"81d4a77aacb0b5863261e7e5fe9eeac6ec61e218","unresolved":false,"context_lines":[{"line_number":450,"context_line":"        if not result:"},{"line_number":451,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":452,"context_line":"    except db_exc.DBError:"},{"line_number":453,"context_line":"        msg \u003d _LW(\"Invalid service id %s in request\") % service_id"},{"line_number":454,"context_line":"        LOG.warn(msg)"},{"line_number":455,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":456,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_0d6f5293","line":453,"updated":"2015-07-06 14:56:46.000000000","message":"do we need the msg variable here\n\nwhy not:\nLOG.warn(_LW(\"Invalid service id %s in request\"), service_id)","commit_id":"6bccdf12a2271c671f1a584137faa5a96202b040"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"f9acce8f5992130fcd7435a657258ab306b25cc7","unresolved":false,"context_lines":[{"line_number":450,"context_line":"        if not result:"},{"line_number":451,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":452,"context_line":"    except db_exc.DBError:"},{"line_number":453,"context_line":"        msg \u003d _LW(\"Invalid service id %s in request\") % service_id"},{"line_number":454,"context_line":"        LOG.warn(msg)"},{"line_number":455,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":456,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_2de6d6e8","line":453,"in_reply_to":"ba3cc151_0d6f5293","updated":"2015-07-06 14:59:04.000000000","message":"I copied the logic in this file :)\n\nyou are right, I can do that~","commit_id":"6bccdf12a2271c671f1a584137faa5a96202b040"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"464f3b1b66d763dc9641ac19f08dbd9fce4fe5f0","unresolved":false,"context_lines":[{"line_number":450,"context_line":"        if not result:"},{"line_number":451,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":452,"context_line":"    except db_exc.DBError:"},{"line_number":453,"context_line":"        LOG.warn(_LW(\"Invalid service id %s in request\") % service_id)"},{"line_number":454,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    return result"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba3cc151_88b5897f","line":453,"updated":"2015-07-06 16:59:01.000000000","message":"minor nit - please use a , instead of a %","commit_id":"0f93611f41fc3ac1be04e898a8be477a5fb175a5"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"bf8ac9a72e2a49dd145aa083b32c8875ec39ed8d","unresolved":false,"context_lines":[{"line_number":450,"context_line":"        if not result:"},{"line_number":451,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":452,"context_line":"    except db_exc.DBError:"},{"line_number":453,"context_line":"        LOG.warn(_LW(\"Invalid service id %s in request\") % service_id)"},{"line_number":454,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    return result"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_191388b9","line":453,"in_reply_to":"ba3cc151_88b5897f","updated":"2015-08-12 14:03:04.000000000","message":"Done","commit_id":"0f93611f41fc3ac1be04e898a8be477a5fb175a5"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"41917a5de2c7b13a07fc34dfdb288737b945a5d7","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        result \u003d query.first()"},{"line_number":447,"context_line":"        if not result:"},{"line_number":448,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":449,"context_line":"    except db_exc.DBError:"},{"line_number":450,"context_line":"        LOG.warn(_LW(\"Invalid service id %s in request\"), service_id)"},{"line_number":451,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_47cbea53","line":449,"updated":"2015-08-18 08:33:56.000000000","message":"this is too generic exception. I think we should check service_id type in the api layer directly.","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6dba5259ba4e9dafe6f60cfce995cdce31a42600","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        result \u003d query.first()"},{"line_number":447,"context_line":"        if not result:"},{"line_number":448,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":449,"context_line":"    except db_exc.DBError:"},{"line_number":450,"context_line":"        LOG.warn(_LW(\"Invalid service id %s in request\"), service_id)"},{"line_number":451,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_e5717d45","line":449,"in_reply_to":"fa1b9901_2541b538","updated":"2015-08-19 18:32:01.000000000","message":"Oh I guess this isn\u0027t DB2 specific, it\u0027s just that what\u0027s passed in is an invalid type (needs to be a non-null integer).  So just validate that in the compute API as Alex pointed out.  The commit message could be updated to make this a bit more clear that that\u0027s what you\u0027re trying to handle.","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c16dc3b084c63e5d95073a63ebfe2e73b71c9426","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        result \u003d query.first()"},{"line_number":447,"context_line":"        if not result:"},{"line_number":448,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":449,"context_line":"    except db_exc.DBError:"},{"line_number":450,"context_line":"        LOG.warn(_LW(\"Invalid service id %s in request\"), service_id)"},{"line_number":451,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_2541b538","line":449,"in_reply_to":"fa1b9901_47cbea53","updated":"2015-08-19 18:28:38.000000000","message":"From the bug report, this is using the ibm_db/ibm_db_sa (DB2) backend for sqlalchemy:\n\nDBError: (DataError) ibm_db_dbi::DataError: Statement Execute Failed: [IBM][CLI Driver] CLI0112E Error in assignment. SQLSTATE\u003d22005 SQLCODE\u003d-99999 \u0027SELECT services.deleted_at AS \n\nWhat does this do in the MySQL case?  I\u0027d expect that if the service isn\u0027t found by id, we don\u0027t get any results and we just raise the ServiceNotFound like we have already.  So what\u0027s different about the ibm_db_sa backend that causes it to raise an error when the query returns nothing?","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"69d0a8fb60455dfa26f6bf7a2f63cc08d7508fdc","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        result \u003d query.first()"},{"line_number":447,"context_line":"        if not result:"},{"line_number":448,"context_line":"            raise exception.ServiceNotFound(service_id\u003dservice_id)"},{"line_number":449,"context_line":"    except db_exc.DBError:"},{"line_number":450,"context_line":"        LOG.warn(_LW(\"Invalid service id %s in request\"), service_id)"},{"line_number":451,"context_line":"        raise exception.InvalidID(id\u003did)"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_2a539218","line":449,"in_reply_to":"fa1b9901_e5717d45","updated":"2015-08-26 13:55:41.000000000","message":"yes, I used db2 as example... I agree with the analysis","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"}],"nova/tests/unit/api/openstack/compute/test_services.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c86e43a840ac4e1414807571f4b916a31a773d4b","unresolved":false,"context_lines":[{"line_number":543,"context_line":"                self.req.environ[\u0027nova.context\u0027], \u00271\u0027)"},{"line_number":544,"context_line":"            self.assertEqual(self.controller.delete.wsgi_code, 204)"},{"line_number":545,"context_line":""},{"line_number":546,"context_line":"    def test_services_delete_not_found(self):"},{"line_number":547,"context_line":"        self.ext_mgr.extensions[\u0027os-extended-services-delete\u0027] \u003d True"},{"line_number":548,"context_line":""},{"line_number":549,"context_line":"        self.assertRaises(webob.exc.HTTPBadRequest,"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_27f37975","line":546,"updated":"2015-08-26 21:13:08.000000000","message":"This is specifically a 404 test case even though it\u0027s testing with an invalid value - you should have a new test case so that both the 404 and 400 cases are covered.  You\u0027d have to mock out the 404 case I guess.","commit_id":"42226604d1b2dcfc91a876a7c6587e2690bdbd3d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"0a328fdbca38dee75de0a454b5c8ce85c5f76cbb","unresolved":false,"context_lines":[{"line_number":550,"context_line":"                          self.controller.delete, self.req, 1234)"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_services_delete_bad_request(self):"},{"line_number":553,"context_line":"        self.ext_mgr.extensions[\u0027os-extended-services-delete\u0027] \u003d True"},{"line_number":554,"context_line":""},{"line_number":555,"context_line":"        self.assertRaises(webob.exc.HTTPBadRequest,"},{"line_number":556,"context_line":"                          self.controller.delete, self.req, \u0027abc\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"da20952f_117f0e16","line":553,"updated":"2015-08-29 06:46:27.000000000","message":"Emm. ext_mgr is v2 API stuff, we should move it into v2 unittest. But this isn\u0027t your fault. Let\u0027s cleanup it later.","commit_id":"47715e1ea8548d6e2b37c226e762b57db9a5da25"}],"nova/tests/unit/db/test_db_api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c16dc3b084c63e5d95073a63ebfe2e73b71c9426","unresolved":false,"context_lines":[{"line_number":3122,"context_line":"                          db.service_get, self.ctxt, 100500)"},{"line_number":3123,"context_line":""},{"line_number":3124,"context_line":"    def test_service_get_invalid_id(self):"},{"line_number":3125,"context_line":"        with mock.patch(\u0027sqlalchemy.orm.query.Query.first\u0027,"},{"line_number":3126,"context_line":"                side_effect\u003ddb_exc.DBError):"},{"line_number":3127,"context_line":"            self.assertRaises(exception.InvalidID,"},{"line_number":3128,"context_line":"                              db.service_get, self.ctxt, 1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_657fad66","line":3125,"updated":"2015-08-19 18:28:38.000000000","message":"You shouldn\u0027t mock this out.  If you want to actually test an invalid value passed in for the service id, then do that, don\u0027t pass 1 which is completely value given the data model:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/db/sqlalchemy/models.py#n96","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"69d0a8fb60455dfa26f6bf7a2f63cc08d7508fdc","unresolved":false,"context_lines":[{"line_number":3122,"context_line":"                          db.service_get, self.ctxt, 100500)"},{"line_number":3123,"context_line":""},{"line_number":3124,"context_line":"    def test_service_get_invalid_id(self):"},{"line_number":3125,"context_line":"        with mock.patch(\u0027sqlalchemy.orm.query.Query.first\u0027,"},{"line_number":3126,"context_line":"                side_effect\u003ddb_exc.DBError):"},{"line_number":3127,"context_line":"            self.assertRaises(exception.InvalidID,"},{"line_number":3128,"context_line":"                              db.service_get, self.ctxt, 1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_6f00bc02","line":3125,"in_reply_to":"fa1b9901_657fad66","updated":"2015-08-26 13:55:41.000000000","message":"thanks, I removed the whole test :)","commit_id":"bba9ddd1ff76b00f695901ddd770a61f9ba9efa3"}]}
