)]}'
{"ironic/api/controllers/v1/allocation.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"654587ee1c3a31710b0a44c9dea41f98e4cc7044","unresolved":false,"context_lines":[{"line_number":391,"context_line":"        context \u003d pecan.request.context"},{"line_number":392,"context_line":"        cdict \u003d context.to_policy_values()"},{"line_number":393,"context_line":"        policy.authorize(\u0027baremetal:allocation:update\u0027, cdict, cdict)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        self._validate_patch(patch)"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        rpc_allocation \u003d api_utils.get_rpc_allocation_with_suffix(allocation_ident)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fce034c_1739d3a2","line":394,"updated":"2019-04-18 08:43:19.000000000","message":"We need to add a new microversion and check it here.","commit_id":"ccfb8f0e8e284ca820636479a2c074a8762db361"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"654587ee1c3a31710b0a44c9dea41f98e4cc7044","unresolved":false,"context_lines":[{"line_number":392,"context_line":"        cdict \u003d context.to_policy_values()"},{"line_number":393,"context_line":"        policy.authorize(\u0027baremetal:allocation:update\u0027, cdict, cdict)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        self._validate_patch(patch)"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        rpc_allocation \u003d api_utils.get_rpc_allocation_with_suffix(allocation_ident)"},{"line_number":398,"context_line":"        names \u003d api_utils.get_patch_values(patch, \u0027/name\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fce034c_373e4f8c","line":395,"updated":"2019-04-18 08:43:19.000000000","message":"This call doesn\u0027t seem to eixst.","commit_id":"ccfb8f0e8e284ca820636479a2c074a8762db361"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"654587ee1c3a31710b0a44c9dea41f98e4cc7044","unresolved":false,"context_lines":[{"line_number":400,"context_line":"            error_msg \u003d (_(\"Allocation %s: Cannot change name to invalid name \")"},{"line_number":401,"context_line":"                         % allocation_ident)"},{"line_number":402,"context_line":"            error_msg +\u003d \"\u0027%(name)s\u0027\""},{"line_number":403,"context_line":"            self._check_names_acceptable(names, error_msg)"},{"line_number":404,"context_line":""},{"line_number":405,"context_line":"        allocation_dict \u003d rpc_allocation.as_dict()"},{"line_number":406,"context_line":"        allocation \u003d Allocation(**api_utils.apply_jsonpatch(allocation_dict, patch))"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fce034c_d73eeb89","line":403,"updated":"2019-04-18 08:43:19.000000000","message":"This call doesn\u0027t seem to exist","commit_id":"ccfb8f0e8e284ca820636479a2c074a8762db361"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"654587ee1c3a31710b0a44c9dea41f98e4cc7044","unresolved":false,"context_lines":[{"line_number":405,"context_line":"        allocation_dict \u003d rpc_allocation.as_dict()"},{"line_number":406,"context_line":"        allocation \u003d Allocation(**api_utils.apply_jsonpatch(allocation_dict, patch))"},{"line_number":407,"context_line":"        try:"},{"line_number":408,"context_line":"            topic \u003d pecan.request.rpcapi.get_topic_for(rpc_allocation)"},{"line_number":409,"context_line":"        except exception.NoValidHost as e:"},{"line_number":410,"context_line":"            # NOTE(deva): convert from 404 to 400 because client can see"},{"line_number":411,"context_line":"            #             list of available drivers and shouldn\u0027t request"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fce034c_f743e711","line":408,"updated":"2019-04-18 08:43:19.000000000","message":"This is not going to work, RPC topics only exist for nodes. Fortunately, we don\u0027t need. Let\u0027s not go through RPC for this task at all.","commit_id":"ccfb8f0e8e284ca820636479a2c074a8762db361"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"654587ee1c3a31710b0a44c9dea41f98e4cc7044","unresolved":false,"context_lines":[{"line_number":414,"context_line":"            raise"},{"line_number":415,"context_line":""},{"line_number":416,"context_line":"        with notify.handle_error_notification(context, rpc_allocation, \u0027update\u0027):"},{"line_number":417,"context_line":"            new_allocation \u003d pecan.request.rpcapi.update_allocation(context,"},{"line_number":418,"context_line":"                                                        rpc_allocation, topic)"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        api_allocation \u003d Allocation.convert_with_links(new_allocation)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fce034c_974ce342","line":417,"updated":"2019-04-18 08:43:19.000000000","message":"No need for RPC, just use save() on the allocation.","commit_id":"ccfb8f0e8e284ca820636479a2c074a8762db361"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0523f2952bca04ec9a63eb202791d7d78edd483d","unresolved":false,"context_lines":[{"line_number":383,"context_line":"        return Allocation.convert_with_links(new_allocation)"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    def _validate_patch(self, patch):"},{"line_number":386,"context_line":"        allowed_fields \u003d [\u0027/name\u0027]"},{"line_number":387,"context_line":"        for p in patch:"},{"line_number":388,"context_line":"            if p[\u0027path\u0027] not in allowed_fields:"},{"line_number":389,"context_line":"                msg \u003d _(\"Cannot update %s in an allocation. Only `name` and \""}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_cdbb16e3","line":386,"updated":"2019-04-23 08:17:13.000000000","message":"also /extra and anything inside it","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10206,"name":"Madhuri Kumari","email":"madhuri.kumari@intel.com","username":"Madhuri"},"change_message_id":"6f08d37853182fa0a91100612db5ded2ea3172ba","unresolved":false,"context_lines":[{"line_number":383,"context_line":"        return Allocation.convert_with_links(new_allocation)"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    def _validate_patch(self, patch):"},{"line_number":386,"context_line":"        allowed_fields \u003d [\u0027/name\u0027]"},{"line_number":387,"context_line":"        for p in patch:"},{"line_number":388,"context_line":"            if p[\u0027path\u0027] not in allowed_fields:"},{"line_number":389,"context_line":"                msg \u003d _(\"Cannot update %s in an allocation. Only `name` and \""}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_8d82fec7","line":386,"in_reply_to":"ffb9cba7_cdbb16e3","updated":"2019-04-23 09:24:22.000000000","message":"Done","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0523f2952bca04ec9a63eb202791d7d78edd483d","unresolved":false,"context_lines":[{"line_number":402,"context_line":"        context \u003d pecan.request.context"},{"line_number":403,"context_line":"        cdict \u003d context.to_policy_values()"},{"line_number":404,"context_line":"        policy.authorize(\u0027baremetal:allocation:update\u0027, cdict, cdict)"},{"line_number":405,"context_line":"        if not api_utils.allow_allocation_update():"},{"line_number":406,"context_line":"            raise exception.NotAcceptable(_("},{"line_number":407,"context_line":"                \"The API version does not allow updating allocations\"))"},{"line_number":408,"context_line":"        self._validate_patch(patch)"},{"line_number":409,"context_line":"        name \u003d api_utils.get_patch_values(patch, \u0027/name\u0027)"},{"line_number":410,"context_line":"        if len(name) and not api_utils.is_valid_logical_name(name):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_0d1b6e1b","line":407,"range":{"start_line":405,"start_character":0,"end_line":407,"end_character":71},"updated":"2019-04-23 08:17:13.000000000","message":"Please move this before checking the policy.\n\nAlso the exception should be MethodNotAllowed to keep the same error code.","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10206,"name":"Madhuri Kumari","email":"madhuri.kumari@intel.com","username":"Madhuri"},"change_message_id":"6f08d37853182fa0a91100612db5ded2ea3172ba","unresolved":false,"context_lines":[{"line_number":402,"context_line":"        context \u003d pecan.request.context"},{"line_number":403,"context_line":"        cdict \u003d context.to_policy_values()"},{"line_number":404,"context_line":"        policy.authorize(\u0027baremetal:allocation:update\u0027, cdict, cdict)"},{"line_number":405,"context_line":"        if not api_utils.allow_allocation_update():"},{"line_number":406,"context_line":"            raise exception.NotAcceptable(_("},{"line_number":407,"context_line":"                \"The API version does not allow updating allocations\"))"},{"line_number":408,"context_line":"        self._validate_patch(patch)"},{"line_number":409,"context_line":"        name \u003d api_utils.get_patch_values(patch, \u0027/name\u0027)"},{"line_number":410,"context_line":"        if len(name) and not api_utils.is_valid_logical_name(name):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_ed661a52","line":407,"range":{"start_line":405,"start_character":0,"end_line":407,"end_character":71},"in_reply_to":"ffb9cba7_0d1b6e1b","updated":"2019-04-23 09:24:22.000000000","message":"Done","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0523f2952bca04ec9a63eb202791d7d78edd483d","unresolved":false,"context_lines":[{"line_number":417,"context_line":"        allocation \u003d Allocation(**api_utils.apply_jsonpatch(allocation_dict,"},{"line_number":418,"context_line":"                                                            patch))"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        # Update only the fields that have changed"},{"line_number":421,"context_line":"        for field in objects.Allocation.fields:"},{"line_number":422,"context_line":"            try:"},{"line_number":423,"context_line":"                patch_val \u003d getattr(allocation, field)"},{"line_number":424,"context_line":"            except AttributeError:"},{"line_number":425,"context_line":"                # Ignore fields that aren\u0027t exposed in the API"},{"line_number":426,"context_line":"                continue"},{"line_number":427,"context_line":"            if patch_val \u003d\u003d wtypes.Unset:"},{"line_number":428,"context_line":"                patch_val \u003d None"},{"line_number":429,"context_line":"            if rpc_allocation[field] !\u003d patch_val:"},{"line_number":430,"context_line":"                rpc_allocation[field] \u003d patch_val"},{"line_number":431,"context_line":""},{"line_number":432,"context_line":"        notify.emit_start_notification(context, rpc_allocation, \u0027update\u0027)"},{"line_number":433,"context_line":"        with notify.handle_error_notification(context,"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_0df04ec9","line":430,"range":{"start_line":420,"start_character":0,"end_line":430,"end_character":49},"updated":"2019-04-23 08:17:13.000000000","message":"I don\u0027t think you need this, I\u0027d expect apply_jsonpatch to handle it..","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10206,"name":"Madhuri Kumari","email":"madhuri.kumari@intel.com","username":"Madhuri"},"change_message_id":"6f08d37853182fa0a91100612db5ded2ea3172ba","unresolved":false,"context_lines":[{"line_number":417,"context_line":"        allocation \u003d Allocation(**api_utils.apply_jsonpatch(allocation_dict,"},{"line_number":418,"context_line":"                                                            patch))"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        # Update only the fields that have changed"},{"line_number":421,"context_line":"        for field in objects.Allocation.fields:"},{"line_number":422,"context_line":"            try:"},{"line_number":423,"context_line":"                patch_val \u003d getattr(allocation, field)"},{"line_number":424,"context_line":"            except AttributeError:"},{"line_number":425,"context_line":"                # Ignore fields that aren\u0027t exposed in the API"},{"line_number":426,"context_line":"                continue"},{"line_number":427,"context_line":"            if patch_val \u003d\u003d wtypes.Unset:"},{"line_number":428,"context_line":"                patch_val \u003d None"},{"line_number":429,"context_line":"            if rpc_allocation[field] !\u003d patch_val:"},{"line_number":430,"context_line":"                rpc_allocation[field] \u003d patch_val"},{"line_number":431,"context_line":""},{"line_number":432,"context_line":"        notify.emit_start_notification(context, rpc_allocation, \u0027update\u0027)"},{"line_number":433,"context_line":"        with notify.handle_error_notification(context,"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_add582bb","line":430,"range":{"start_line":420,"start_character":0,"end_line":430,"end_character":49},"in_reply_to":"ffb9cba7_0df04ec9","updated":"2019-04-23 09:24:22.000000000","message":"It doesn\u0027t work with only apply_jsonpatch","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":23851,"name":"Riccardo Pittau","email":"elfosardo@gmail.com","username":"elfosardo"},"change_message_id":"ed9abb01354ca81dd381e69899b2e6c91b142f37","unresolved":false,"context_lines":[{"line_number":387,"context_line":"        for p in patch:"},{"line_number":388,"context_line":"            path \u003d p[\u0027path\u0027].split(\u0027/\u0027)[1]"},{"line_number":389,"context_line":"            if path not in allowed_fields:"},{"line_number":390,"context_line":"                msg \u003d _(\"Cannot update %s in an allocation. Only `name` and \""},{"line_number":391,"context_line":"                        \"`extra` are allowed to be updated.\")"},{"line_number":392,"context_line":"                raise exception.Invalid(msg % p[\u0027path\u0027])"},{"line_number":393,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"dfbec78f_5609beda","line":390,"range":{"start_line":390,"start_character":65,"end_line":390,"end_character":71},"updated":"2019-05-09 10:24:00.000000000","message":"nit: change backquotes ` to single quotes \u0027","commit_id":"baded37bcca367e3ea6f908a5b079c2893ed5e2c"},{"author":{"_account_id":23851,"name":"Riccardo Pittau","email":"elfosardo@gmail.com","username":"elfosardo"},"change_message_id":"ed9abb01354ca81dd381e69899b2e6c91b142f37","unresolved":false,"context_lines":[{"line_number":388,"context_line":"            path \u003d p[\u0027path\u0027].split(\u0027/\u0027)[1]"},{"line_number":389,"context_line":"            if path not in allowed_fields:"},{"line_number":390,"context_line":"                msg \u003d _(\"Cannot update %s in an allocation. Only `name` and \""},{"line_number":391,"context_line":"                        \"`extra` are allowed to be updated.\")"},{"line_number":392,"context_line":"                raise exception.Invalid(msg % p[\u0027path\u0027])"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"    @METRICS.timer(\u0027AllocationsController.patch\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfbec78f_1613460f","line":391,"range":{"start_line":391,"start_character":25,"end_line":391,"end_character":32},"updated":"2019-05-09 10:24:00.000000000","message":"ditto","commit_id":"baded37bcca367e3ea6f908a5b079c2893ed5e2c"}],"ironic/common/policy.py":[{"author":{"_account_id":23851,"name":"Riccardo Pittau","email":"elfosardo@gmail.com","username":"elfosardo"},"change_message_id":"ed9abb01354ca81dd381e69899b2e6c91b142f37","unresolved":false,"context_lines":[{"line_number":426,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":427,"context_line":"        \u0027baremetal:allocation:update\u0027,"},{"line_number":428,"context_line":"        \u0027rule:is_admin\u0027,"},{"line_number":429,"context_line":"        \u0027Change name and extra field of an allocation\u0027,"},{"line_number":430,"context_line":"        [{\u0027path\u0027: \u0027/allocations/{allocation_id}\u0027, \u0027method\u0027: \u0027PATCH\u0027}]),"},{"line_number":431,"context_line":"]"},{"line_number":432,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"dfbec78f_f65a32f1","line":429,"range":{"start_line":429,"start_character":31,"end_line":429,"end_character":36},"updated":"2019-05-09 10:24:00.000000000","message":"nit: fields","commit_id":"baded37bcca367e3ea6f908a5b079c2893ed5e2c"}],"ironic/tests/unit/api/controllers/v1/test_allocation.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0523f2952bca04ec9a63eb202791d7d78edd483d","unresolved":false,"context_lines":[{"line_number":380,"context_line":"        super(TestPatch, self).setUp()"},{"line_number":381,"context_line":"        self.allocation \u003d obj_utils.create_test_allocation(self.context)"},{"line_number":382,"context_line":""},{"line_number":383,"context_line":"    def test_update_not_found(self):"},{"line_number":384,"context_line":"        uuid \u003d uuidutils.generate_uuid()"},{"line_number":385,"context_line":"        response \u003d self.patch_json(\u0027/allocation/%s\u0027 % uuid,"},{"line_number":386,"context_line":"                                   [{\u0027path\u0027: \u0027/name\u0027, \u0027value\u0027: \u0027b\u0027,"},{"line_number":387,"context_line":"                                     \u0027op\u0027: \u0027replace\u0027}],"},{"line_number":388,"context_line":"                                   expect_errors\u003dTrue)"},{"line_number":389,"context_line":"        self.assertEqual(http_client.NOT_FOUND, response.status_int)"},{"line_number":390,"context_line":"        self.assertEqual(\u0027application/json\u0027, response.content_type)"},{"line_number":391,"context_line":"        self.assertTrue(response.json[\u0027error_message\u0027])"},{"line_number":392,"context_line":""},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"def _create_locally(_api, _ctx, allocation, _topic):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_cda0f6a8","line":391,"range":{"start_line":383,"start_character":0,"end_line":391,"end_character":55},"updated":"2019-04-23 08:17:13.000000000","message":"This unit tests should not change, we need to keep the old behavior. However, please add unit tests for updating /name and /extra with new API version. Please also check that other fields cannot be updated.","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10206,"name":"Madhuri Kumari","email":"madhuri.kumari@intel.com","username":"Madhuri"},"change_message_id":"6f08d37853182fa0a91100612db5ded2ea3172ba","unresolved":false,"context_lines":[{"line_number":380,"context_line":"        super(TestPatch, self).setUp()"},{"line_number":381,"context_line":"        self.allocation \u003d obj_utils.create_test_allocation(self.context)"},{"line_number":382,"context_line":""},{"line_number":383,"context_line":"    def test_update_not_found(self):"},{"line_number":384,"context_line":"        uuid \u003d uuidutils.generate_uuid()"},{"line_number":385,"context_line":"        response \u003d self.patch_json(\u0027/allocation/%s\u0027 % uuid,"},{"line_number":386,"context_line":"                                   [{\u0027path\u0027: \u0027/name\u0027, \u0027value\u0027: \u0027b\u0027,"},{"line_number":387,"context_line":"                                     \u0027op\u0027: \u0027replace\u0027}],"},{"line_number":388,"context_line":"                                   expect_errors\u003dTrue)"},{"line_number":389,"context_line":"        self.assertEqual(http_client.NOT_FOUND, response.status_int)"},{"line_number":390,"context_line":"        self.assertEqual(\u0027application/json\u0027, response.content_type)"},{"line_number":391,"context_line":"        self.assertTrue(response.json[\u0027error_message\u0027])"},{"line_number":392,"context_line":""},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"def _create_locally(_api, _ctx, allocation, _topic):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb9cba7_c383e555","line":391,"range":{"start_line":383,"start_character":0,"end_line":391,"end_character":55},"in_reply_to":"ffb9cba7_cda0f6a8","updated":"2019-04-23 09:24:22.000000000","message":"Done","commit_id":"2932322b888a3d341384b2c6d141176f0ffbdd61"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b01b8254b9cb0b955fae2ed10b6968f3b380ac70","unresolved":false,"context_lines":[{"line_number":559,"context_line":"        self.assertEqual(\u0027application/json\u0027, response.content_type)"},{"line_number":560,"context_line":"        self.assertEqual(http_client.BAD_REQUEST, response.status_code)"},{"line_number":561,"context_line":"        self.assertTrue(response.json[\u0027error_message\u0027])"},{"line_number":562,"context_line":""},{"line_number":563,"context_line":""},{"line_number":564,"context_line":"def _create_locally(_api, _ctx, allocation, _topic):"},{"line_number":565,"context_line":"    allocation.create()"}],"source_content_type":"text/x-python","patch_set":6,"id":"bfb3d3c7_43407508","line":562,"updated":"2019-05-17 10:41:45.000000000","message":"could you add a unit test on fields that cannot be updated? maybe check node_uuid, resource_class, traits, candidate_nodes in a loop?","commit_id":"aec48ca2752127403c4b6f72706d9897cde10ee4"}]}
