)]}'
{"keystone/limit/models/strict_two_level.py":[{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"34c8dfe3fb85923d0c55f473a1ebb4711494287a","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    MAX_PROJECT_TREE_DEPTH \u003d 2"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def check_limit(self, project_id, resource_name, resource_limit,"},{"line_number":35,"context_line":"                    service_id, region_id\u003dNone):"},{"line_number":36,"context_line":"        # build a common hints instance since we\u0027ll need it later and this"},{"line_number":37,"context_line":"        # reduces defining it multple times"},{"line_number":38,"context_line":"        hints \u003d driver_hints.Hints()"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_7650a560","line":35,"updated":"2018-07-12 11:17:20.000000000","message":"In this way, the input limit only compare with the limits in db. it ignored the other input limits, so a case is missed:\n\nsuppose the registered limit is 10 by default, then if I create three limits like the tree below in one request:\n       A,13\n     /    \\\n  B,12   C,11\nit should pass, but actually it raise 403.\n\nThis is the reason why i pass the whole input limits into the check function. See L100-L108 at left part.","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"72832bdcaa41406aea7461d89d624fa71a23a378","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    MAX_PROJECT_TREE_DEPTH \u003d 2"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def check_limit(self, project_id, resource_name, resource_limit,"},{"line_number":35,"context_line":"                    service_id, region_id\u003dNone):"},{"line_number":36,"context_line":"        # build a common hints instance since we\u0027ll need it later and this"},{"line_number":37,"context_line":"        # reduces defining it multple times"},{"line_number":38,"context_line":"        hints \u003d driver_hints.Hints()"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_96578128","line":35,"in_reply_to":"5f7c97a3_7650a560","updated":"2018-07-12 11:22:25.000000000","message":"I mean creating limit is quite different with updating limit, since we support creating limit in batch. So we should combine input and backend\u0027s limit together to check limit.","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ef1059eb39c9b5259605989bc4481095139c3588","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    MAX_PROJECT_TREE_DEPTH \u003d 2"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def check_limit(self, project_id, resource_name, resource_limit,"},{"line_number":35,"context_line":"                    service_id, region_id\u003dNone):"},{"line_number":36,"context_line":"        # build a common hints instance since we\u0027ll need it later and this"},{"line_number":37,"context_line":"        # reduces defining it multple times"},{"line_number":38,"context_line":"        hints \u003d driver_hints.Hints()"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_83caca9d","line":35,"in_reply_to":"5f7c97a3_96578128","updated":"2018-07-13 03:07:22.000000000","message":"Ahh - now I see why you did that. It ultimately boils down to having a POST API that supports batch creation... (which isn\u0027t necessarily normal by keystone standards).\n\nI guess there isn\u0027t anything stopping us from having two separate methods in this interface. Something just tells me that there should only be one since they essentially boil down to checking the same thing (the validity of the limit). I see now that it\u0027s not really the fault of _this_ interface, but perhaps the oddity in the POST /v3/limits API that forces this interface to deal with it in a specific way.\n\nMaybe two methods is how we\u0027re going to have to deal with it for now.","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"cc7fc84d0abc72fad0e8bf7716df4387cddf360c","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    def check_limit(self, project_id, resource_name, resource_limit,"},{"line_number":35,"context_line":"                    service_id, region_id\u003dNone):"},{"line_number":36,"context_line":"        # build a common hints instance since we\u0027ll need it later and this"},{"line_number":37,"context_line":"        # reduces defining it multple times"},{"line_number":38,"context_line":"        hints \u003d driver_hints.Hints()"},{"line_number":39,"context_line":"        hints.add_filter(\u0027service_id\u0027, service_id)"},{"line_number":40,"context_line":"        hints.add_filter(\u0027resource_name\u0027, resource_name)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_9f19df24","line":37,"range":{"start_line":37,"start_character":30,"end_line":37,"end_character":37},"updated":"2018-07-12 02:39:37.000000000","message":"multiple","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ef1059eb39c9b5259605989bc4481095139c3588","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    def check_limit(self, project_id, resource_name, resource_limit,"},{"line_number":35,"context_line":"                    service_id, region_id\u003dNone):"},{"line_number":36,"context_line":"        # build a common hints instance since we\u0027ll need it later and this"},{"line_number":37,"context_line":"        # reduces defining it multple times"},{"line_number":38,"context_line":"        hints \u003d driver_hints.Hints()"},{"line_number":39,"context_line":"        hints.add_filter(\u0027service_id\u0027, service_id)"},{"line_number":40,"context_line":"        hints.add_filter(\u0027resource_name\u0027, resource_name)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_43bcb206","line":37,"range":{"start_line":37,"start_character":30,"end_line":37,"end_character":37},"in_reply_to":"5f7c97a3_9f19df24","updated":"2018-07-13 03:07:22.000000000","message":"++","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"cc7fc84d0abc72fad0e8bf7716df4387cddf360c","unresolved":false,"context_lines":[{"line_number":72,"context_line":"                        reason\u003d\"Limit is smaller than child\")"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _has_parent_project(self, project_id):"},{"line_number":75,"context_line":"        parent \u003d PROVIDERS.resource_api.list_project_parents(project_id)[0]"},{"line_number":76,"context_line":"        if parent.get(\u0027is_domain\u0027):"},{"line_number":77,"context_line":"            return False"},{"line_number":78,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_5fe827de","line":75,"range":{"start_line":75,"start_character":8,"end_line":75,"end_character":14},"updated":"2018-07-12 02:39:37.000000000","message":"this parent can be reused for L81","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ef1059eb39c9b5259605989bc4481095139c3588","unresolved":false,"context_lines":[{"line_number":72,"context_line":"                        reason\u003d\"Limit is smaller than child\")"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _has_parent_project(self, project_id):"},{"line_number":75,"context_line":"        parent \u003d PROVIDERS.resource_api.list_project_parents(project_id)[0]"},{"line_number":76,"context_line":"        if parent.get(\u0027is_domain\u0027):"},{"line_number":77,"context_line":"            return False"},{"line_number":78,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_23c17682","line":75,"range":{"start_line":75,"start_character":8,"end_line":75,"end_character":14},"in_reply_to":"5f7c97a3_5fe827de","updated":"2018-07-13 03:07:22.000000000","message":"++","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"d179423917d278a714b2ad3251b1abf4273a4f0c","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _has_parent_project(self, project_id):"},{"line_number":75,"context_line":"        parent \u003d PROVIDERS.resource_api.list_project_parents(project_id)[0]"},{"line_number":76,"context_line":"        if parent.get(\u0027is_domain\u0027):"},{"line_number":77,"context_line":"            return False"},{"line_number":78,"context_line":"        return True"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_68214bfc","line":76,"updated":"2018-07-16 23:52:23.000000000","message":"just return directly:\n \n  return not parent.get(\u0027is_domain\u0027)","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"}],"keystone/tests/unit/test_limits.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"0977af76e7b133713e3940d1bf5898453fe698be","unresolved":false,"context_lines":[{"line_number":965,"context_line":""},{"line_number":966,"context_line":"    def test_create_multi_limits(self):"},{"line_number":967,"context_line":"        # success to create a tree in one request like:"},{"line_number":968,"context_line":"        #    A,12         D,10"},{"line_number":969,"context_line":"        #    / \\          / \\"},{"line_number":970,"context_line":"        #  B,9  C,5    E,5   F,4"},{"line_number":971,"context_line":"        ref_A \u003d unit.new_limit_ref(project_id\u003dself.project_A[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_51d4a14b","line":968,"range":{"start_line":968,"start_character":28,"end_line":968,"end_character":30},"updated":"2018-07-11 21:59:04.000000000","message":"If D is 9, it fails because the project tree is already created and E is assuming a default of 10. This isn\u0027t a case we explicitly call out in the specification, but we do say that if you create a project root with a limit lower than the default, all children will assume the limit of the parent (we might need to add a test for that).\n\nBut I somehow uncovered this after combining the logic for update and create limit enforcement checks \u003cshrug\u003e","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"cc7fc84d0abc72fad0e8bf7716df4387cddf360c","unresolved":false,"context_lines":[{"line_number":965,"context_line":""},{"line_number":966,"context_line":"    def test_create_multi_limits(self):"},{"line_number":967,"context_line":"        # success to create a tree in one request like:"},{"line_number":968,"context_line":"        #    A,12         D,10"},{"line_number":969,"context_line":"        #    / \\          / \\"},{"line_number":970,"context_line":"        #  B,9  C,5    E,5   F,4"},{"line_number":971,"context_line":"        ref_A \u003d unit.new_limit_ref(project_id\u003dself.project_A[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_df6c3709","line":968,"range":{"start_line":968,"start_character":28,"end_line":968,"end_character":30},"in_reply_to":"5f7c97a3_51d4a14b","updated":"2018-07-12 02:39:37.000000000","message":"I think this case should be considered, otherwise the refactor looks good.","commit_id":"2f067563dd14bd61ddb45d714488373ce56c8db6"}]}
