)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"92ff51b607f5f670065ec2e771fee31cf7220ca5","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This change fixes an issue when it is possible to specify name twice"},{"line_number":10,"context_line":"in the patch, and only first value was checked for correctness."},{"line_number":11,"context_line":"Instead, only the last one should be checked."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1566731"},{"line_number":14,"context_line":"Change-Id: I4301876d9d4b060c69616b893dcdbc36e41a6369"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"5a18252c_6aa564a0","line":11,"updated":"2016-04-14 21:51:31.000000000","message":"Do you also mean that if something is specified more than once, ironic will only look at (or use) the last one?\n\nOr should we error on it?\n\nIs it the convention to use the last one rather than the first one?","commit_id":"83d3c0dd970353a6353fb45801adf954430acfbb"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"d2d2844a2da2a605533d74dcb80e4e0d67a5b7d9","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This change fixes an issue when it is possible to specify name twice"},{"line_number":10,"context_line":"in the patch, and only first value was checked for correctness."},{"line_number":11,"context_line":"Instead, only the last one should be checked."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1566731"},{"line_number":14,"context_line":"Change-Id: I4301876d9d4b060c69616b893dcdbc36e41a6369"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"1a122d0e_a8e1ffd2","line":11,"in_reply_to":"5a18252c_6aa564a0","updated":"2016-04-15 12:07:39.000000000","message":"This is the value that will be written in DB as patches are applied consequently, so I think it\u0027s OK to check only last one. I\u0027ll clarify it here.","commit_id":"83d3c0dd970353a6353fb45801adf954430acfbb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"cac76c48af331c37f43725c8d74e5b94d445efe7","unresolved":false,"context_lines":[{"line_number":9,"context_line":"This change fixes an issue when it is possible to specify name"},{"line_number":10,"context_line":"multiple times in the patch, and only first of them is checked"},{"line_number":11,"context_line":"for correctness. Instead, all of them should be checked, as stated"},{"line_number":12,"context_line":"in JSON PATCH RFC https://tools.ietf.org/html/rfc6902."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Closes-Bug: #1566731"},{"line_number":15,"context_line":"Change-Id: I4301876d9d4b060c69616b893dcdbc36e41a6369"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"1a122d0e_b0bbdce3","line":12,"updated":"2016-05-03 22:21:03.000000000","message":"If you do another revision, maybe be clearer, eg s/all of them should be checked, as stated in/all of them should be evaluated until an error condition is encountered or the last name is applied. See/","commit_id":"faead8980a16c733e1bdc4077c996528d7c31e7e"}],"ironic/api/controllers/v1/node.py":[{"author":{"_account_id":13362,"name":"Tan Lin","email":"lin.tan@intel.com","username":"zero"},"change_message_id":"a23a6e7863b11bbca4c90b4b264f0bccd982bffb","unresolved":false,"context_lines":[{"line_number":1258,"context_line":"            raise wsme.exc.ClientSideError("},{"line_number":1259,"context_line":"                msg % node_ident, status_code\u003dhttp_client.CONFLICT)"},{"line_number":1260,"context_line":""},{"line_number":1261,"context_line":"        is_name_removed \u003d api_utils.is_path_removed(patch, \u0027/name\u0027)"},{"line_number":1262,"context_line":"        if is_name_removed and not api_utils.allow_node_logical_names():"},{"line_number":1263,"context_line":"            raise exception.NotAcceptable()"},{"line_number":1264,"context_line":"        name \u003d api_utils.get_patch_value(patch, \u0027/name\u0027)"},{"line_number":1265,"context_line":"        if name is not None:"},{"line_number":1266,"context_line":"            error_msg \u003d _(\"Node %(node)s: Cannot change name to invalid \""},{"line_number":1267,"context_line":"                          \"name \u0027%(name)s\u0027\") % {\u0027node\u0027: node_ident,"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a061dce_fdf9c4c9","line":1264,"range":{"start_line":1261,"start_character":6,"end_line":1264,"end_character":56},"updated":"2016-04-05 08:29:24.000000000","message":"This kind of duplicate because you always check is_path_removed and get_patch_value, you only need one of them for one patch.","commit_id":"d54672dc8d4e8bc506b51b090d65f2b4f59a37a4"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"f5e669af1fc4514cc7fd7ffe1d540d910159f680","unresolved":false,"context_lines":[{"line_number":1258,"context_line":"            raise wsme.exc.ClientSideError("},{"line_number":1259,"context_line":"                msg % node_ident, status_code\u003dhttp_client.CONFLICT)"},{"line_number":1260,"context_line":""},{"line_number":1261,"context_line":"        is_name_removed \u003d api_utils.is_path_removed(patch, \u0027/name\u0027)"},{"line_number":1262,"context_line":"        if is_name_removed and not api_utils.allow_node_logical_names():"},{"line_number":1263,"context_line":"            raise exception.NotAcceptable()"},{"line_number":1264,"context_line":"        name \u003d api_utils.get_patch_value(patch, \u0027/name\u0027)"},{"line_number":1265,"context_line":"        if name is not None:"},{"line_number":1266,"context_line":"            error_msg \u003d _(\"Node %(node)s: Cannot change name to invalid \""},{"line_number":1267,"context_line":"                          \"name \u0027%(name)s\u0027\") % {\u0027node\u0027: node_ident,"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a061dce_b9a63751","line":1264,"range":{"start_line":1261,"start_character":6,"end_line":1264,"end_character":56},"in_reply_to":"9a061dce_fdf9c4c9","updated":"2016-04-05 11:17:12.000000000","message":"Good catch, thanks for review!","commit_id":"d54672dc8d4e8bc506b51b090d65f2b4f59a37a4"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"712ea47387e1f61f2e5680ce01a5ee54436a0059","unresolved":false,"context_lines":[{"line_number":1258,"context_line":"            raise wsme.exc.ClientSideError("},{"line_number":1259,"context_line":"                msg % node_ident, status_code\u003dhttp_client.CONFLICT)"},{"line_number":1260,"context_line":""},{"line_number":1261,"context_line":"        if api_utils.is_path_removed(patch, \u0027/name\u0027):"},{"line_number":1262,"context_line":"            if not api_utils.allow_node_logical_names():"},{"line_number":1263,"context_line":"                raise exception.NotAcceptable()"},{"line_number":1264,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a061dce_7e3be038","line":1261,"updated":"2016-04-05 12:34:59.000000000","message":"Actually, it seems that the previous way was more correct. Consider the following request:\n\n curl -i -X PATCH http://127.0.0.1:6385/v1/nodes/10c0b922-cb39-412e-849a-27e66042d4c0 -H \u0027Content-Type: application/json\u0027 -H \u0027X-Auth-Token: 53658731b7df4185a2fafc142e1fc2bd\u0027 -d \u0027[{\"op\": \"remove\", \"path\": \"/name\"}, {\"op\": \"add\", \"path\": \"/name\", \"value\": \"_incorrect_name$$\"}]\u0027\n\nIf version \u003e1.5 is used, it is a valid request, but it will only check that remove operation is allowed, and won\u0027t check that name provided further is valid.","commit_id":"96c13383427615c7a29970488f21df0e71e78f54"},{"author":{"_account_id":13362,"name":"Tan Lin","email":"lin.tan@intel.com","username":"zero"},"change_message_id":"ab780b5431d0454addb1587022479ad9b04f967f","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"                msg % node_ident, status_code\u003dhttp_client.CONFLICT)"},{"line_number":1260,"context_line":""},{"line_number":1261,"context_line":"        # Check both removal and addition/replacement as one patch"},{"line_number":1262,"context_line":"        # can contain both"},{"line_number":1263,"context_line":"        is_name_removed \u003d api_utils.is_path_removed(patch, \u0027/name\u0027)"},{"line_number":1264,"context_line":"        if is_name_removed and not api_utils.allow_node_logical_names():"},{"line_number":1265,"context_line":"            raise exception.NotAcceptable()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a061dce_d92658cd","line":1262,"updated":"2016-04-06 07:19:48.000000000","message":"Hmmm, it\u0027s really a corner case. A note is better. \n\n\nBut I am thinking a general issue. Should we allow a multi-manipulation for one path in one patch? Because it could happen more then two. And then we have issues with get_patch_value() and is_path_removed(), which will only return the first value of the same path . \n\n\nSo we should check this in JsonPatchType.validate(). This could be done in another patch but I still think we only need to check removal or non-removal once here.","commit_id":"bc90dac7f79cb95b945ecbfd872f491145bdfb9f"},{"author":{"_account_id":13362,"name":"Tan Lin","email":"lin.tan@intel.com","username":"zero"},"change_message_id":"c54dd22a0b704efcbf5f130ed2275fbdbd29cfdc","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"                msg % node_ident, status_code\u003dhttp_client.CONFLICT)"},{"line_number":1260,"context_line":""},{"line_number":1261,"context_line":"        # Check both removal and addition/replacement as one patch"},{"line_number":1262,"context_line":"        # can contain both"},{"line_number":1263,"context_line":"        is_name_removed \u003d api_utils.is_path_removed(patch, \u0027/name\u0027)"},{"line_number":1264,"context_line":"        if is_name_removed and not api_utils.allow_node_logical_names():"},{"line_number":1265,"context_line":"            raise exception.NotAcceptable()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a061dce_afd7d6bd","line":1262,"in_reply_to":"9a061dce_d92658cd","updated":"2016-04-06 08:02:55.000000000","message":"OK, just check the JsonPatch library, it allowed a list of patch operations even for a same path. But still have a concern about get_patch_value() for a multiple-operation patch like [{\u0027op\u0027: \u0027replace\u0027, \u0027path\u0027: \u0027name\u0027, \u0027value\u0027: \u0027node-0\u0027}, {\u0027op\u0027: \u0027replace\u0027, \u0027path\u0027: \u0027name\u0027, \u0027value\u0027: \u0027_incorrect_name$$\"\u0027}], it will pass the check_name_acceptable but apply \u0027_incorecct_name$$\u0027 to node.","commit_id":"bc90dac7f79cb95b945ecbfd872f491145bdfb9f"},{"author":{"_account_id":13362,"name":"Tan Lin","email":"lin.tan@intel.com","username":"zero"},"change_message_id":"5d3ac4e8e9d6dd916bc43add592780fc8e1a6373","unresolved":false,"context_lines":[{"line_number":1267,"context_line":"            # If name update is valid, removal will be valid too"},{"line_number":1268,"context_line":"        elif api_utils.is_path_removed(patch, \u0027/name\u0027):"},{"line_number":1269,"context_line":"            if not api_utils.allow_node_logical_names():"},{"line_number":1270,"context_line":"                raise exception.NotAcceptable()"},{"line_number":1271,"context_line":""},{"line_number":1272,"context_line":"        try:"},{"line_number":1273,"context_line":"            node_dict \u003d rpc_node.as_dict()"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a061dce_2ad419bb","line":1270,"updated":"2016-04-07 06:24:18.000000000","message":"Interesting, there still an issue if you pass a multi-action patch like \u0027[{\u0027patch\u0027: \u0027/name\u0027, \u0027op: \u0027remove\u0027}, {\u0027path\u0027: \u0027/name\u0027, \u0027value\u0027: \u0027node-1\u0027, \u0027op\u0027: \u0027replace\u0027}}]\u0027 \n\nBecause patch will try to remove \u0027name\u0027 and then try to replace it again, which will raise a bad request of \u0027can\u0027t replace non-existent object \u0027name\u0027\u0027\n\nBut I think this is a wrong input from user. So I am fine with current implementation.","commit_id":"f598d8cac0328e2bfff3946e0a858f544b32e370"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"246745b435813b061d15e6d6969b71dee822e581","unresolved":false,"context_lines":[{"line_number":1024,"context_line":""},{"line_number":1025,"context_line":"        This function will raise an exception for unacceptable names."},{"line_number":1026,"context_line":""},{"line_number":1027,"context_line":"        :param names: list of node names in the patch"},{"line_number":1028,"context_line":"        :param error_msg: error message in case of wsme.exc.ClientSideError,"},{"line_number":1029,"context_line":"            should contain %(name)s placeholder."},{"line_number":1030,"context_line":"        :raises: exception.NotAcceptable"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_b43bf537","line":1027,"updated":"2016-04-22 08:51:39.000000000","message":"Please remove last words \"in the patch\", used for post also.","commit_id":"3ef770a8261c13845f2b99c48bc48c4a6ddd84b2"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"246745b435813b061d15e6d6969b71dee822e581","unresolved":false,"context_lines":[{"line_number":1265,"context_line":"            raise wsme.exc.ClientSideError("},{"line_number":1266,"context_line":"                msg % node_ident, status_code\u003dhttp_client.CONFLICT)"},{"line_number":1267,"context_line":""},{"line_number":1268,"context_line":"        name \u003d api_utils.get_patch_values(patch, \u0027/name\u0027)"},{"line_number":1269,"context_line":"        if len(name):"},{"line_number":1270,"context_line":"            error_msg \u003d (_(\"Node %s: Cannot change name to invalid name \")"},{"line_number":1271,"context_line":"                         % node_ident)"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_f41c4dc3","line":1268,"updated":"2016-04-22 08:51:39.000000000","message":"Better rename: name -\u003e names","commit_id":"3ef770a8261c13845f2b99c48bc48c4a6ddd84b2"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"2235f66b4f56aa2661cba9ccf6f91cdffb578553","unresolved":false,"context_lines":[{"line_number":1032,"context_line":"        \"\"\""},{"line_number":1033,"context_line":"        if not api_utils.allow_node_logical_names():"},{"line_number":1034,"context_line":"            raise exception.NotAcceptable()"},{"line_number":1035,"context_line":"        for name in names:"},{"line_number":1036,"context_line":"            if not api_utils.is_valid_node_name(name):"},{"line_number":1037,"context_line":"                raise wsme.exc.ClientSideError("},{"line_number":1038,"context_line":"                    error_msg % {\u0027name\u0027: name},"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a122d0e_0404e9bd","line":1035,"updated":"2016-04-25 19:42:17.000000000","message":"if several invalid names are specified only first is checked and error will contain only first invalid match. Maybe check all of them and add all invalid names to error message?","commit_id":"faead8980a16c733e1bdc4077c996528d7c31e7e"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"cac76c48af331c37f43725c8d74e5b94d445efe7","unresolved":false,"context_lines":[{"line_number":1032,"context_line":"        \"\"\""},{"line_number":1033,"context_line":"        if not api_utils.allow_node_logical_names():"},{"line_number":1034,"context_line":"            raise exception.NotAcceptable()"},{"line_number":1035,"context_line":"        for name in names:"},{"line_number":1036,"context_line":"            if not api_utils.is_valid_node_name(name):"},{"line_number":1037,"context_line":"                raise wsme.exc.ClientSideError("},{"line_number":1038,"context_line":"                    error_msg % {\u0027name\u0027: name},"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a122d0e_f0839401","line":1035,"in_reply_to":"1a122d0e_0404e9bd","updated":"2016-05-03 22:21:03.000000000","message":"That\u0027s reasonable, but in this case, I\u0027m not sure it is worth doing the extra work. The JSON patch rfc mentions in page 3, \"Evaluation continues until all operations are successfully applied or until an error condition is encountered\". So it is fine to stop when the first error occurs.","commit_id":"faead8980a16c733e1bdc4077c996528d7c31e7e"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"ed36d3cce32bbc131e72c5669d20bb2961638387","unresolved":false,"context_lines":[{"line_number":1032,"context_line":"        \"\"\""},{"line_number":1033,"context_line":"        if not api_utils.allow_node_logical_names():"},{"line_number":1034,"context_line":"            raise exception.NotAcceptable()"},{"line_number":1035,"context_line":"        for name in names:"},{"line_number":1036,"context_line":"            if not api_utils.is_valid_node_name(name):"},{"line_number":1037,"context_line":"                raise wsme.exc.ClientSideError("},{"line_number":1038,"context_line":"                    error_msg % {\u0027name\u0027: name},"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a122d0e_bb90d043","line":1035,"in_reply_to":"1a122d0e_f0839401","updated":"2016-05-04 09:13:32.000000000","message":"Yeah I agree with keeping it simple, plus, it\u0027s very uncommon to update the same resource multiple times in the same request for our API.","commit_id":"faead8980a16c733e1bdc4077c996528d7c31e7e"}],"ironic/api/controllers/v1/utils.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"92ff51b607f5f670065ec2e771fee31cf7220ca5","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def get_patch_value(patch, path):"},{"line_number":83,"context_line":"    # patch is reversed here as the last patch element will contain the value"},{"line_number":84,"context_line":"    # that will be applied the last"},{"line_number":85,"context_line":"    for p in reversed(patch):"},{"line_number":86,"context_line":"        if p[\u0027path\u0027] \u003d\u003d path and p[\u0027op\u0027] !\u003d \u0027remove\u0027:"},{"line_number":87,"context_line":"            return p[\u0027value\u0027]"}],"source_content_type":"text/x-python","patch_set":9,"id":"5a18252c_aa477cba","line":84,"updated":"2016-04-14 21:51:31.000000000","message":"I think this ought to be clarified. I am guessing you mean that if the path is specified more than once in the patch, we will return the last value.\n\nMaybe s/applied the last/returned/ is sufficient.","commit_id":"83d3c0dd970353a6353fb45801adf954430acfbb"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"d2d2844a2da2a605533d74dcb80e4e0d67a5b7d9","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def get_patch_value(patch, path):"},{"line_number":83,"context_line":"    # patch is reversed here as the last patch element will contain the value"},{"line_number":84,"context_line":"    # that will be applied the last"},{"line_number":85,"context_line":"    for p in reversed(patch):"},{"line_number":86,"context_line":"        if p[\u0027path\u0027] \u003d\u003d path and p[\u0027op\u0027] !\u003d \u0027remove\u0027:"},{"line_number":87,"context_line":"            return p[\u0027value\u0027]"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a122d0e_48d14bfb","line":84,"in_reply_to":"5a18252c_aa477cba","updated":"2016-04-15 12:07:39.000000000","message":"will rewrite.","commit_id":"83d3c0dd970353a6353fb45801adf954430acfbb"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6f23a3a803d46e7266a1494bf669b4a4097fefa1","unresolved":false,"context_lines":[{"line_number":94,"context_line":"    \"\"\""},{"line_number":95,"context_line":"    for p in reversed(patch):"},{"line_number":96,"context_line":"        if p[\u0027path\u0027] \u003d\u003d path and p[\u0027op\u0027] !\u003d \u0027remove\u0027:"},{"line_number":97,"context_line":"            return p[\u0027value\u0027]"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def allow_node_logical_names():"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a122d0e_463657e8","line":97,"updated":"2016-04-21 15:32:47.000000000","message":"Based in the IRC conversation about how patch handles it, we should actually verify the chain of patches and fail if any of them is incorrect.","commit_id":"75962b15da22591c9074ed59eea9fdfba0a9b5df"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"cac76c48af331c37f43725c8d74e5b94d445efe7","unresolved":false,"context_lines":[{"line_number":85,"context_line":"    If there are multiple values specified for the same path"},{"line_number":86,"context_line":"    (for example the patch is [{\u0027op\u0027: \u0027add\u0027, \u0027path\u0027: \u0027/name\u0027, \u0027value\u0027: \u0027abc\u0027},"},{"line_number":87,"context_line":"                               {\u0027op\u0027: \u0027add\u0027, \u0027path\u0027: \u0027/name\u0027, \u0027value\u0027: \u0027bca\u0027}])"},{"line_number":88,"context_line":"    return all of them in a list (preserving order)."},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"    :param patch: HTTP PATCH request body."},{"line_number":91,"context_line":"    :param path: the path to get the patch values for."}],"source_content_type":"text/x-python","patch_set":12,"id":"1a122d0e_b0059c7a","line":88,"updated":"2016-05-03 22:21:03.000000000","message":"just a nit, if you do another revision. You\u0027re returning a list, regardless of whether there is one or more than one value. This makes it sound like a list is only returned if there are multiple values.","commit_id":"faead8980a16c733e1bdc4077c996528d7c31e7e"}]}
