)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":14,"context_line":"Inventories are presented with a view marker named"},{"line_number":15,"context_line":"\u0027resource_provider_generation\u0027 which is used to avoid concurrent"},{"line_number":16,"context_line":"updates. ETags were considered for this functionality but discussion"},{"line_number":17,"context_line":"amongts interested parties led to the conclusion that the marker"},{"line_number":18,"context_line":"was more explicit, especially in the case of taking an inventory"},{"line_number":19,"context_line":"representation \"seen\" in a collection representation, updating it,"},{"line_number":20,"context_line":"and sending it back to the server."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"1aa78d24_d1e3c931","line":17,"range":{"start_line":17,"start_character":0,"end_line":17,"end_character":7},"updated":"2016-07-05 21:04:18.000000000","message":"\"amongst\"","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9a83e2fa4fe7cc37e1c14498fbd70d2bf87b0d83","unresolved":false,"context_lines":[{"line_number":14,"context_line":"Inventories are presented with a view marker named"},{"line_number":15,"context_line":"\u0027resource_provider_generation\u0027 which is used to avoid concurrent"},{"line_number":16,"context_line":"updates. ETags were considered for this functionality but discussion"},{"line_number":17,"context_line":"amongts interested parties led to the conclusion that the marker"},{"line_number":18,"context_line":"was more explicit, especially in the case of taking an inventory"},{"line_number":19,"context_line":"representation \"seen\" in a collection representation, updating it,"},{"line_number":20,"context_line":"and sending it back to the server."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"1aa78d24_8c78082d","line":17,"in_reply_to":"1aa78d24_d1e3c931","updated":"2016-07-05 21:34:01.000000000","message":"Done","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fae822373b59fd9b101262124e2089c0ba78279c","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Roman Podoliaka \u003crpodolyaka@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-08-09 18:30:30 +0300"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add support for resource inventories to placement API"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"GET to list /resource_providers/{uuid}/inventories"},{"line_number":10,"context_line":"POST to create a single new inventory via"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":55,"id":"9ad45d7e_9956acd0","line":7,"updated":"2016-08-09 17:33:38.000000000","message":"it\u0027s just \"inventories\" not \"resource inventories\" :)","commit_id":"ede27088fa072ed38c81ae11fa02122d3ff2736b"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"5cc17780ee9de61b4cec579f399a589ec255358d","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Roman Podoliaka \u003crpodolyaka@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-08-09 18:30:30 +0300"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add support for resource inventories to placement API"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"GET to list /resource_providers/{uuid}/inventories"},{"line_number":10,"context_line":"POST to create a single new inventory via"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":55,"id":"9ad45d7e_d3d6e14d","line":7,"in_reply_to":"9ad45d7e_9956acd0","updated":"2016-08-11 10:05:43.000000000","message":"we better move them to /inventories instead of /resource_providers/{uuid}/inventories then ... :P\n\nThere ought to be a never go in against an information scientist joke in here somewhere","commit_id":"ede27088fa072ed38c81ae11fa02122d3ff2736b"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fae822373b59fd9b101262124e2089c0ba78279c","unresolved":false,"context_lines":[{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Inventories are presented with a view marker named"},{"line_number":18,"context_line":"\u0027resource_provider_generation\u0027 which is used to avoid concurrent"},{"line_number":19,"context_line":"updates. ETags were considered for this functionality but discussion"},{"line_number":20,"context_line":"amongst interested parties led to the conclusion that the marker"},{"line_number":21,"context_line":"was more explicit, especially in the case of taking an inventory"},{"line_number":22,"context_line":"representation \"seen\" in a collection representation, updating it,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":55,"id":"9ad45d7e_795138d8","line":19,"updated":"2016-08-09 17:33:38.000000000","message":"meh, well, technically the resource_provider_generation isn\u0027t used to *avoid* concurrent updates. It\u0027s used to enable consistent views of inventory across concurrent updates, but ok :)","commit_id":"ede27088fa072ed38c81ae11fa02122d3ff2736b"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"5cc17780ee9de61b4cec579f399a589ec255358d","unresolved":false,"context_lines":[{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Inventories are presented with a view marker named"},{"line_number":18,"context_line":"\u0027resource_provider_generation\u0027 which is used to avoid concurrent"},{"line_number":19,"context_line":"updates. ETags were considered for this functionality but discussion"},{"line_number":20,"context_line":"amongst interested parties led to the conclusion that the marker"},{"line_number":21,"context_line":"was more explicit, especially in the case of taking an inventory"},{"line_number":22,"context_line":"representation \"seen\" in a collection representation, updating it,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":55,"id":"9ad45d7e_330dbde8","line":19,"in_reply_to":"9ad45d7e_795138d8","updated":"2016-08-11 10:05:43.000000000","message":"It\u0027s doing both, no? If the generation is wrong you get a 409. That\u0027s _exactly_ what an etag does. I included this because anyone not familiar with the back story but familiar with standard HTTP who is going through these commits would likely want to know \"how come they didn\u0027t use etags here\"?","commit_id":"ede27088fa072ed38c81ae11fa02122d3ff2736b"}],"nova/api/openstack/placement/handlers/inventory.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7cad7dbbbad07cfc88cc468b0d85dc4f5c97023a","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from nova import objects"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"BASE_INVENTORY_SCHEMA \u003d {"},{"line_number":27,"context_line":"    \"type\": \"object\","},{"line_number":28,"context_line":"    \"properties\": {"},{"line_number":29,"context_line":"        \"resource_provider_generation\": {"}],"source_content_type":"text/x-python","patch_set":11,"id":"3aaa91ec_4e301657","line":26,"updated":"2016-06-22 14:28:24.000000000","message":"Just an observation, but in the existing nova-api the schema is all separated from the code using it, and we decorate the validation on the methods. I like actually having the schema in the same location as what\u0027s using it. The messy part, I think, is going to be when we change the schema with microversions, but that\u0027s also messy in the schema modules in nova-api, so it probably doesn\u0027t really make much of a difference where the mess lives, and it\u0027s still probably useful to have it closer to what\u0027s using it.","commit_id":"6f71321ccadf86ed52b8d4afed9334692d018304"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":73,"context_line":"    context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":74,"context_line":"    uuid \u003d util.wsgi_path_item(req.environ, \u0027uuid\u0027)"},{"line_number":75,"context_line":"    resource_provider \u003d objects.ResourceProvider.get_by_uuid("},{"line_number":76,"context_line":"        context, uuid)"},{"line_number":77,"context_line":"    data \u003d _extract_inventory(req.body, POST_INVENTORY_SCHEMA)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    inventory \u003d objects.Inventory("}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_71a01544","line":76,"updated":"2016-07-05 21:04:18.000000000","message":"Don\u0027t we need to catch this NotFound ? If it doesn\u0027t throw it, surely we shouldn\u0027t make the ill-fated call below.","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9a83e2fa4fe7cc37e1c14498fbd70d2bf87b0d83","unresolved":false,"context_lines":[{"line_number":73,"context_line":"    context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":74,"context_line":"    uuid \u003d util.wsgi_path_item(req.environ, \u0027uuid\u0027)"},{"line_number":75,"context_line":"    resource_provider \u003d objects.ResourceProvider.get_by_uuid("},{"line_number":76,"context_line":"        context, uuid)"},{"line_number":77,"context_line":"    data \u003d _extract_inventory(req.body, POST_INVENTORY_SCHEMA)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    inventory \u003d objects.Inventory("}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_4cebc0b0","line":76,"in_reply_to":"1aa78d24_71a01544","updated":"2016-07-05 21:34:01.000000000","message":"It\u0027s caught in nova.api.openstack.placement.handler.PlacementHandler which turns it into a webob-style exception instead of a nova.exception. Since there are several places where the NotFound can raise it seemed better to centralize it?","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        context,"},{"line_number":81,"context_line":"        resource_provider\u003dresource_provider,"},{"line_number":82,"context_line":"        **data)"},{"line_number":83,"context_line":"    inventory.obj_set_defaults()"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    try:"},{"line_number":86,"context_line":"        resource_provider.add_inventory(inventory)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_f14fe5ba","line":83,"updated":"2016-07-05 21:04:18.000000000","message":"I kinda feel like defaults for things not specified by the client should be here in the API code. We don\u0027t version-track the defaults changes in the object and may change them at will later. However, this will almost definitely be a behavior change for the client, which we should avoid (or control by a version). Thus, belongs in API code, IMHO.","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9a83e2fa4fe7cc37e1c14498fbd70d2bf87b0d83","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        context,"},{"line_number":81,"context_line":"        resource_provider\u003dresource_provider,"},{"line_number":82,"context_line":"        **data)"},{"line_number":83,"context_line":"    inventory.obj_set_defaults()"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    try:"},{"line_number":86,"context_line":"        resource_provider.add_inventory(inventory)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_6cff9c67","line":83,"in_reply_to":"1aa78d24_f14fe5ba","updated":"2016-07-05 21:34:01.000000000","message":"ah, okay, makes sense, will fix","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    resource_class \u003d util.wsgi_path_item(req.environ, \u0027resource_class\u0027)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    resource_provider \u003d objects.ResourceProvider.get_by_uuid("},{"line_number":113,"context_line":"        context, uuid)"},{"line_number":114,"context_line":"    try:"},{"line_number":115,"context_line":"        resource_provider.delete_inventory(resource_class)"},{"line_number":116,"context_line":"    except exception.ConcurrentUpdateDetected as exc:"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_f1fd253b","line":113,"updated":"2016-07-05 21:04:18.000000000","message":"ditto","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":130,"context_line":"    context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":131,"context_line":"    uuid \u003d util.wsgi_path_item(req.environ, \u0027uuid\u0027)"},{"line_number":132,"context_line":"    resource_provider \u003d objects.ResourceProvider.get_by_uuid("},{"line_number":133,"context_line":"        context, uuid)"},{"line_number":134,"context_line":"    inventories \u003d objects.InventoryList.get_all_by_resource_provider_uuid("},{"line_number":135,"context_line":"        context, resource_provider.uuid)"},{"line_number":136,"context_line":"    response \u003d req.response"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_51ecf98e","line":133,"updated":"2016-07-05 21:04:18.000000000","message":"double ditto","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":147,"context_line":"    uuid \u003d util.wsgi_path_item(req.environ, \u0027uuid\u0027)"},{"line_number":148,"context_line":"    resource_class \u003d util.wsgi_path_item(req.environ, \u0027resource_class\u0027)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    resource_provider \u003d objects.ResourceProvider.get_by_uuid("},{"line_number":151,"context_line":"        context, uuid)"},{"line_number":152,"context_line":"    inventory \u003d objects.InventoryList.get_all_by_resource_provider_uuid("},{"line_number":153,"context_line":"        context, resource_provider.uuid).find(resource_class)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_31efad88","line":150,"updated":"2016-07-05 21:04:18.000000000","message":"double dog ditto","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    resource_class \u003d util.wsgi_path_item(req.environ, \u0027resource_class\u0027)"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    resource_provider \u003d objects.ResourceProvider.get_by_uuid("},{"line_number":176,"context_line":"        context, uuid)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    data \u003d _extract_inventory(req.body, BASE_INVENTORY_SCHEMA)"},{"line_number":179,"context_line":"    if data[\u0027resource_provider_generation\u0027] !\u003d resource_provider.generation:"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_51ba396f","line":176,"updated":"2016-07-05 21:04:18.000000000","message":"yeah.","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":206,"context_line":"    return response"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"def _extract_inventory(body, schema):"},{"line_number":210,"context_line":"    \"\"\"Extract and validate inventory from JSON body.\"\"\""},{"line_number":211,"context_line":"    try:"},{"line_number":212,"context_line":"        data \u003d jsonutils.loads(body)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_b1d27dfe","line":209,"updated":"2016-07-05 21:04:18.000000000","message":"Can you put this and the following helpers at the top please? They\u0027re used above, so it should be above the use, IMHO and per our general convention.","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9a83e2fa4fe7cc37e1c14498fbd70d2bf87b0d83","unresolved":false,"context_lines":[{"line_number":206,"context_line":"    return response"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"def _extract_inventory(body, schema):"},{"line_number":210,"context_line":"    \"\"\"Extract and validate inventory from JSON body.\"\"\""},{"line_number":211,"context_line":"    try:"},{"line_number":212,"context_line":"        data \u003d jsonutils.loads(body)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_2c2c7401","line":209,"in_reply_to":"1aa78d24_b1d27dfe","updated":"2016-07-05 21:34:01.000000000","message":"I was not aware of that convention, thanks, I\u0027ve always done the opposite (public first, private second).","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"b9fceb8b7b38244a2e97f0dda4b56ec243d38869","unresolved":false,"context_lines":[{"line_number":226,"context_line":""},{"line_number":227,"context_line":"def _serialize_inventory(generation, inventory):"},{"line_number":228,"context_line":"    data \u003d {"},{"line_number":229,"context_line":"        field: getattr(inventory, field)"},{"line_number":230,"context_line":"        for field in OUTPUT_INVENTORY_FIELDS"},{"line_number":231,"context_line":"    }"},{"line_number":232,"context_line":"    data[\u0027resource_provider_generation\u0027] \u003d generation"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_d1ee29b3","line":229,"updated":"2016-07-05 21:04:18.000000000","message":"This means the API will change any time we change the model, right? We need to avoid that as we\u0027ll just violate our own contract if we don\u0027t put an exception in here at the same time that happens.","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9a83e2fa4fe7cc37e1c14498fbd70d2bf87b0d83","unresolved":false,"context_lines":[{"line_number":226,"context_line":""},{"line_number":227,"context_line":"def _serialize_inventory(generation, inventory):"},{"line_number":228,"context_line":"    data \u003d {"},{"line_number":229,"context_line":"        field: getattr(inventory, field)"},{"line_number":230,"context_line":"        for field in OUTPUT_INVENTORY_FIELDS"},{"line_number":231,"context_line":"    }"},{"line_number":232,"context_line":"    data[\u0027resource_provider_generation\u0027] \u003d generation"}],"source_content_type":"text/x-python","patch_set":18,"id":"1aa78d24_072a337e","line":229,"in_reply_to":"1aa78d24_d1ee29b3","updated":"2016-07-05 21:34:01.000000000","message":"In an earlier version I had it explicitly listing fields rather than querying the Inventory object and someone (maybe Jay?) suggested otherwise.\n\nThe various _serialize* methods aren\u0027t yet microversion aware, essentially because that would be like trying to predict the future. The idea is that they could be passed a version eventually.\n\nWhat should be done?","commit_id":"19d1b67da77f2125bae89a091029fbb1853aab4d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"559309f45e1ff01596ded95d67dcc30a00958813","unresolved":false,"context_lines":[{"line_number":31,"context_line":"        },"},{"line_number":32,"context_line":"        \"resource_class\": {"},{"line_number":33,"context_line":"            \"type\": \"string\","},{"line_number":34,"context_line":"            \"pattern\": \"^[A-Z_]+\""},{"line_number":35,"context_line":"        },"},{"line_number":36,"context_line":"        \"total\": {"},{"line_number":37,"context_line":"            \"type\": \"integer\""}],"source_content_type":"text/x-python","patch_set":40,"id":"dada55a8_f2c04c52","line":34,"updated":"2016-07-20 22:30:06.000000000","message":"Note to self: This is the wrong pattern here. Should be something more like ^[A-Z0-9_]+$.","commit_id":"526425ebd18467b302eb727cdc345731c024a021"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"559309f45e1ff01596ded95d67dcc30a00958813","unresolved":false,"context_lines":[{"line_number":316,"context_line":""},{"line_number":317,"context_line":"    inventory \u003d objects.Inventory(resource_provider\u003dresource_provider,"},{"line_number":318,"context_line":"                                  resource_class\u003dresource_class,"},{"line_number":319,"context_line":"                                  **data)"},{"line_number":320,"context_line":""},{"line_number":321,"context_line":"    try:"},{"line_number":322,"context_line":"        resource_provider.update_inventory(inventory)"}],"source_content_type":"text/x-python","patch_set":40,"id":"dada55a8_329ca45c","line":319,"updated":"2016-07-20 22:30:06.000000000","message":"another note to self:\n\nIf resource_class is in data than a TypeError will happen here. One of the following should happen:\n\n* either the schema for update should not have resource_class\n* data[\u0027resource_class\u0027] should be deleted and ignored\n* data[\u0027resource_class\u0027] should be popped and compared the class in the url and 400 is we\u0027ve got a mismatch","commit_id":"526425ebd18467b302eb727cdc345731c024a021"},{"author":{"_account_id":13692,"name":"Roman Dobosz","email":"gryf73@gmail.com","username":"gryf"},"change_message_id":"b3bc7633885b4d618000fe1d99117db088885dd1","unresolved":false,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"def _extract_json(body, schema):"},{"line_number":103,"context_line":"    \"\"\"Extract and validate data from JSON body.\"\"\""},{"line_number":104,"context_line":"    try:"},{"line_number":105,"context_line":"        data \u003d jsonutils.loads(body)"},{"line_number":106,"context_line":"    except ValueError as exc:"},{"line_number":107,"context_line":"        raise webob.exc.HTTPBadRequest("},{"line_number":108,"context_line":"            \u0027Malformed JSON: %s\u0027 % exc,"},{"line_number":109,"context_line":"            json_formatter\u003dutil.json_error_formatter)"},{"line_number":110,"context_line":"    try:"},{"line_number":111,"context_line":"        jsonschema.validate(data, schema)"},{"line_number":112,"context_line":"    except jsonschema.ValidationError as exc:"},{"line_number":113,"context_line":"        raise webob.exc.HTTPBadRequest("},{"line_number":114,"context_line":"            \u0027JSON does not validate: %s\u0027 % exc,"},{"line_number":115,"context_line":"            json_formatter\u003dutil.json_error_formatter)"},{"line_number":116,"context_line":"    return data"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"def _extract_inventory(body, schema):"}],"source_content_type":"text/x-python","patch_set":47,"id":"bacf61ea_74ef181e","line":116,"range":{"start_line":104,"start_character":4,"end_line":116,"end_character":15},"updated":"2016-08-01 12:30:26.000000000","message":"This two try:except blocks could become one:\n\n\n    try:\n        data \u003d jsonutils.loads(body)\n        jsonschema.validate(data, schema)\n    except (ValueError, jsonschema.ValidationError) as exc:\n        message \u003d (\u0027Malformed JSON: %s\u0027 if isinstance(exc, ValueError) \n            else \u0027JSON does not validate: %s\u0027)\n\n        raise webob.exc.HTTPBadRequest(\n            message % exc,\n            json_formatter\u003dutil.json_error_formatter)","commit_id":"3f3eb68f0a6b57c4824e63b09b7b3d1aadd82cea"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"4b4266333ac5709c6d4018d147d4579b59f53868","unresolved":false,"context_lines":[{"line_number":145,"context_line":"    try:"},{"line_number":146,"context_line":"        inventory \u003d objects.Inventory("},{"line_number":147,"context_line":"            resource_provider\u003dresource_provider, **data)"},{"line_number":148,"context_line":"    except (ValueError, TypeError) as exc:"},{"line_number":149,"context_line":"        raise webob.exc.HTTPBadRequest("},{"line_number":150,"context_line":"            \u0027Bad inventory %s for resource provider %s: %s\u0027"},{"line_number":151,"context_line":"            % (data[\u0027resource_class\u0027], resource_provider.uuid, exc),"}],"source_content_type":"text/x-python","patch_set":61,"id":"3ac371cc_0d093932","line":148,"range":{"start_line":148,"start_character":11,"end_line":148,"end_character":34},"updated":"2016-08-14 03:54:58.000000000","message":"This can be done by json-schema. The only benefit to validate those invalid value in json-schema is API won\u0027t depend on the object implementation. Like we make a mistake: the type of field changed. But of course not sure how many chance we will break that.","commit_id":"e5d94510e41d28faf058750142e7deda315f7233"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"5db6ac551aef6e28879182eba6a97001c1e7ae99","unresolved":false,"context_lines":[{"line_number":145,"context_line":"    try:"},{"line_number":146,"context_line":"        inventory \u003d objects.Inventory("},{"line_number":147,"context_line":"            resource_provider\u003dresource_provider, **data)"},{"line_number":148,"context_line":"    except (ValueError, TypeError) as exc:"},{"line_number":149,"context_line":"        raise webob.exc.HTTPBadRequest("},{"line_number":150,"context_line":"            \u0027Bad inventory %s for resource provider %s: %s\u0027"},{"line_number":151,"context_line":"            % (data[\u0027resource_class\u0027], resource_provider.uuid, exc),"}],"source_content_type":"text/x-python","patch_set":61,"id":"3ac371cc_eeed33b8","line":148,"in_reply_to":"3ac371cc_0127d9ca","updated":"2016-08-17 02:50:52.000000000","message":"yea, that is what I mean, use \u0027minimum\u0027. I\u0027m just afraid the API contract depend on the underlayer implementation. I\u0027m ok fix it later if there isn\u0027t any other things worth to update.","commit_id":"e5d94510e41d28faf058750142e7deda315f7233"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"22b9ca7cabf810fc7029f3f5f242008a501b58ff","unresolved":false,"context_lines":[{"line_number":145,"context_line":"    try:"},{"line_number":146,"context_line":"        inventory \u003d objects.Inventory("},{"line_number":147,"context_line":"            resource_provider\u003dresource_provider, **data)"},{"line_number":148,"context_line":"    except (ValueError, TypeError) as exc:"},{"line_number":149,"context_line":"        raise webob.exc.HTTPBadRequest("},{"line_number":150,"context_line":"            \u0027Bad inventory %s for resource provider %s: %s\u0027"},{"line_number":151,"context_line":"            % (data[\u0027resource_class\u0027], resource_provider.uuid, exc),"}],"source_content_type":"text/x-python","patch_set":61,"id":"3ac371cc_0127d9ca","line":148,"in_reply_to":"3ac371cc_0d093932","updated":"2016-08-16 16:21:10.000000000","message":"Do you mean by doing things like setting a \u0027minimum\u0027 in the schema?\n\nTo me that seems like duplication of the constraints that are in the object fields. yes, we probably want to decouple which fields are legit (as line 82 above) but it seems weird (to me) to make the schema more complex.\n\nI\u0027m conflicted though, so happy to follow advice on this.","commit_id":"e5d94510e41d28faf058750142e7deda315f7233"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"4b4266333ac5709c6d4018d147d4579b59f53868","unresolved":false,"context_lines":[{"line_number":195,"context_line":"    except (exception.ConcurrentUpdateDetected,"},{"line_number":196,"context_line":"            db_exc.DBDuplicateEntry) as exc:"},{"line_number":197,"context_line":"        raise webob.exc.HTTPConflict("},{"line_number":198,"context_line":"            \u0027update conflict: %s\u0027 % exc,"},{"line_number":199,"context_line":"            json_formatter\u003dutil.json_error_formatter)"},{"line_number":200,"context_line":"    except exception.InvalidInventoryCapacity as exc:"},{"line_number":201,"context_line":"        raise webob.exc.HTTPBadRequest("}],"source_content_type":"text/x-python","patch_set":61,"id":"3ac371cc_6d06ed21","line":198,"range":{"start_line":198,"start_character":12,"end_line":198,"end_character":19},"updated":"2016-08-14 03:54:58.000000000","message":"super nit, s/update/Update/","commit_id":"e5d94510e41d28faf058750142e7deda315f7233"}],"nova/tests/functional/api/openstack/placement/gabbits/inventory.yaml":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"4b4266333ac5709c6d4018d147d4579b59f53868","unresolved":false,"context_lines":[{"line_number":119,"context_line":"  response_strings:"},{"line_number":120,"context_line":"      - Unable to update inventory for resource provider $ENVIRON[\u0027RP_UUID\u0027]"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"- name: put inventory bad form"},{"line_number":123,"context_line":"  desc: This should 400 because reserved is greater than total"},{"line_number":124,"context_line":"  PUT: $LAST_URL"},{"line_number":125,"context_line":"  request_headers:"}],"source_content_type":"text/x-yaml","patch_set":61,"id":"3ac371cc_189335a5","line":122,"updated":"2016-08-14 03:54:58.000000000","message":"One more case can be tested, post inventory with duplicated resource-class","commit_id":"e5d94510e41d28faf058750142e7deda315f7233"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"22b9ca7cabf810fc7029f3f5f242008a501b58ff","unresolved":false,"context_lines":[{"line_number":119,"context_line":"  response_strings:"},{"line_number":120,"context_line":"      - Unable to update inventory for resource provider $ENVIRON[\u0027RP_UUID\u0027]"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"- name: put inventory bad form"},{"line_number":123,"context_line":"  desc: This should 400 because reserved is greater than total"},{"line_number":124,"context_line":"  PUT: $LAST_URL"},{"line_number":125,"context_line":"  request_headers:"}],"source_content_type":"text/x-yaml","patch_set":61,"id":"3ac371cc_5c03760d","line":122,"in_reply_to":"3ac371cc_189335a5","updated":"2016-08-16 16:21:10.000000000","message":"Yeah, thanks, I\u0027ve made a note to do so in the next patchset","commit_id":"e5d94510e41d28faf058750142e7deda315f7233"}]}
