)]}'
{"oslo_policy/_checks.py":[{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a679a92805cfa9ea18b8075cba4491b9f9798aec","unresolved":false,"context_lines":[{"line_number":289,"context_line":"    \"\"\""},{"line_number":290,"context_line":""},{"line_number":291,"context_line":"    def _find_in_tree(self, leftval, kind_parts, match):"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"        if len(kind_parts) \u003d\u003d 0:"},{"line_number":294,"context_line":"            return match \u003d\u003d six.text_type(leftval)"},{"line_number":295,"context_line":"        kind_part, kind_parts \u003d kind_parts[0], kind_parts[1:]"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_2a520c68","line":292,"updated":"2015-03-31 13:41:48.000000000","message":"suggest to add comments to explain the steps taken in this method, wasn\u0027t easy to figure out in a first glance","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"374ebe5f7ad28e0362b96dcca0d0e40c7a2f0e3c","unresolved":false,"context_lines":[{"line_number":289,"context_line":"    \"\"\""},{"line_number":290,"context_line":""},{"line_number":291,"context_line":"    def _find_in_tree(self, leftval, kind_parts, match):"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"        if len(kind_parts) \u003d\u003d 0:"},{"line_number":294,"context_line":"            return match \u003d\u003d six.text_type(leftval)"},{"line_number":295,"context_line":"        kind_part, kind_parts \u003d kind_parts[0], kind_parts[1:]"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_c45db57a","line":292,"in_reply_to":"da9b358b_2a520c68","updated":"2015-03-31 15:34:08.000000000","message":"++ recursive code could always use comments","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"374ebe5f7ad28e0362b96dcca0d0e40c7a2f0e3c","unresolved":false,"context_lines":[{"line_number":292,"context_line":""},{"line_number":293,"context_line":"        if len(kind_parts) \u003d\u003d 0:"},{"line_number":294,"context_line":"            return match \u003d\u003d six.text_type(leftval)"},{"line_number":295,"context_line":"        kind_part, kind_parts \u003d kind_parts[0], kind_parts[1:]"},{"line_number":296,"context_line":"        try:"},{"line_number":297,"context_line":"            leftval \u003d leftval[kind_part]"},{"line_number":298,"context_line":"        except KeyError:"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_04c03ddf","line":295,"updated":"2015-03-31 15:34:08.000000000","message":"Again this looks like an indent issue but gerrit could be mid-redering","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a679a92805cfa9ea18b8075cba4491b9f9798aec","unresolved":false,"context_lines":[{"line_number":294,"context_line":"            return match \u003d\u003d six.text_type(leftval)"},{"line_number":295,"context_line":"        kind_part, kind_parts \u003d kind_parts[0], kind_parts[1:]"},{"line_number":296,"context_line":"        try:"},{"line_number":297,"context_line":"            leftval \u003d leftval[kind_part]"},{"line_number":298,"context_line":"        except KeyError:"},{"line_number":299,"context_line":"            return False"},{"line_number":300,"context_line":"        if (isinstance(leftval, list)):"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_ca63a019","line":297,"updated":"2015-03-31 13:41:48.000000000","message":"For me it is easier to read if the code follow the recursion searching for a list first, something like the following:\n\n  if kind_part not in leftval:\n    return False\n  leftval \u003d leftval[kind_part]\n\n  if not isinstance(leftval, list):\n    return self._find_in_tree(leftval, kind_parts, match)\n  \n  # leftval is a list, we need to check if one of it items is present\n  for val in leftval:\n  ...\n\nWhat do you think?","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"374ebe5f7ad28e0362b96dcca0d0e40c7a2f0e3c","unresolved":false,"context_lines":[{"line_number":322,"context_line":"            pass"},{"line_number":323,"context_line":""},{"line_number":324,"context_line":"        kind_parts \u003d self.kind.split(\u0027.\u0027)"},{"line_number":325,"context_line":"        leftval \u003d creds"},{"line_number":326,"context_line":"        return self._find_in_tree(leftval, kind_parts, match)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_a4f99182","line":325,"updated":"2015-03-31 15:34:08.000000000","message":"This looks like an indent issue, but might be a gerrit rendering issue.","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a19af1b0e0a54384ca6a39b0d1f25c5926ebbd82","unresolved":false,"context_lines":[{"line_number":291,"context_line":"    def _find_in_dict(self, leftval, path_segments, match):"},{"line_number":292,"context_line":"        \u0027\u0027\u0027Searches for a match in the dictionary."},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"        leftval is a reference inside the dictionary.  Since the process is"},{"line_number":295,"context_line":"        recursive, each call to _find_in_dict will be one level deeper."},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"        path_segments is the segments of the path to search.  The recursion"}],"source_content_type":"text/x-python","patch_set":2,"id":"da9b358b_de38dda2","line":294,"updated":"2015-03-31 17:30:36.000000000","message":"nit: extra space?","commit_id":"341eb128cd020f1b1f63fed077639b4127000001"},{"author":{"_account_id":2218,"name":"Adam Young","email":"adam@younglogic.com","username":"ayoung"},"change_message_id":"ea67f98c0e60d82b312f0d631968b598e5373726","unresolved":false,"context_lines":[{"line_number":291,"context_line":"    def _find_in_dict(self, leftval, path_segments, match):"},{"line_number":292,"context_line":"        \u0027\u0027\u0027Searches for a match in the dictionary."},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"        leftval is a reference inside the dictionary.  Since the process is"},{"line_number":295,"context_line":"        recursive, each call to _find_in_dict will be one level deeper."},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"        path_segments is the segments of the path to search.  The recursion"}],"source_content_type":"text/x-python","patch_set":2,"id":"da9b358b_7ed551b7","line":294,"in_reply_to":"da9b358b_de38dda2","updated":"2015-03-31 17:36:22.000000000","message":"It was drilled in my head in school: two spaces after the period.  Untraining that will take time.  But, I realize I don\u0027t like the name leftval.","commit_id":"341eb128cd020f1b1f63fed077639b4127000001"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a19af1b0e0a54384ca6a39b0d1f25c5926ebbd82","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            leftval \u003d leftval[key]"},{"line_number":312,"context_line":"        except KeyError:"},{"line_number":313,"context_line":"            return False"},{"line_number":314,"context_line":"        if (isinstance(leftval, list)):"},{"line_number":315,"context_line":"            for val in leftval:"},{"line_number":316,"context_line":"                if self._find_in_dict(val, path_segments, match):"},{"line_number":317,"context_line":"                    return True"}],"source_content_type":"text/x-python","patch_set":2,"id":"da9b358b_5e228d53","line":314,"updated":"2015-03-31 17:30:36.000000000","message":"nit: the outer parentheses are necessary?","commit_id":"341eb128cd020f1b1f63fed077639b4127000001"},{"author":{"_account_id":2218,"name":"Adam Young","email":"adam@younglogic.com","username":"ayoung"},"change_message_id":"ea67f98c0e60d82b312f0d631968b598e5373726","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            leftval \u003d leftval[key]"},{"line_number":312,"context_line":"        except KeyError:"},{"line_number":313,"context_line":"            return False"},{"line_number":314,"context_line":"        if (isinstance(leftval, list)):"},{"line_number":315,"context_line":"            for val in leftval:"},{"line_number":316,"context_line":"                if self._find_in_dict(val, path_segments, match):"},{"line_number":317,"context_line":"                    return True"}],"source_content_type":"text/x-python","patch_set":2,"id":"da9b358b_9e45b571","line":314,"in_reply_to":"da9b358b_5e228d53","updated":"2015-03-31 17:36:22.000000000","message":"No they are not.  still thinking in C","commit_id":"341eb128cd020f1b1f63fed077639b4127000001"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"f46e264e9862760d8764e32330fbec7b9ad900a4","unresolved":false,"context_lines":[{"line_number":294,"context_line":"        test_value is a reference inside the dictionary. Since the process is"},{"line_number":295,"context_line":"        recursive, each call to _find_in_dict will be one level deeper."},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"        path_segments is the segments of the path to search.  The recursion"},{"line_number":298,"context_line":"        ends when there are no more segments of path."},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        When specifying a value inside a list, each element of the list is"}],"source_content_type":"text/x-python","patch_set":3,"id":"da9b358b_e93889a2","line":297,"updated":"2015-03-31 20:41:50.000000000","message":"nit: another extra space here, sorry for don\u0027t notice before","commit_id":"a08bc79f5c117696c43feb2e44c4dc5fd0013deb"}],"oslo_policy/tests/test_checks.py":[{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a679a92805cfa9ea18b8075cba4491b9f9798aec","unresolved":false,"context_lines":[{"line_number":226,"context_line":"        self.assertTrue(check({}, credentials, self.enforcer))"},{"line_number":227,"context_line":""},{"line_number":228,"context_line":"    def test_multiple_entry_in_list_accepted(self):"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"        check \u003d _checks.GenericCheck(\u0027a.b.c.d\u0027, \u0027APPLES\u0027)"},{"line_number":231,"context_line":"        credentials \u003d {\u0027a\u0027: {\u0027b\u0027: {\u0027c\u0027: {\u0027d\u0027: [\u0027Bananas\u0027,"},{"line_number":232,"context_line":"                                               \u0027APPLES\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_7c420740","line":229,"updated":"2015-03-31 13:41:48.000000000","message":"why the empty line?","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a679a92805cfa9ea18b8075cba4491b9f9798aec","unresolved":false,"context_lines":[{"line_number":234,"context_line":"        self.assertTrue(check({}, credentials, self.enforcer))"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    def test_multiple_entry_in_nested_list_accepted(self):"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"        check \u003d _checks.GenericCheck(\u0027a.b.c.d\u0027, \u0027APPLES\u0027)"},{"line_number":239,"context_line":"        credentials \u003d {\u0027a\u0027: {\u0027b\u0027: [{\u0027c\u0027:"},{"line_number":240,"context_line":"                                    {\u0027d\u0027: [\u0027BANANAS\u0027, \u0027APPLES\u0027, \u0027GRAPES\u0027]}},"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_3c4c7f6f","line":237,"updated":"2015-03-31 13:41:48.000000000","message":"same as above","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"374ebe5f7ad28e0362b96dcca0d0e40c7a2f0e3c","unresolved":false,"context_lines":[{"line_number":238,"context_line":"        check \u003d _checks.GenericCheck(\u0027a.b.c.d\u0027, \u0027APPLES\u0027)"},{"line_number":239,"context_line":"        credentials \u003d {\u0027a\u0027: {\u0027b\u0027: [{\u0027c\u0027:"},{"line_number":240,"context_line":"                                    {\u0027d\u0027: [\u0027BANANAS\u0027, \u0027APPLES\u0027, \u0027GRAPES\u0027]}},"},{"line_number":241,"context_line":"                                   {}]}}"},{"line_number":242,"context_line":"        self.assertTrue(check({}, credentials, self.enforcer))"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"    def test_multiple_nested_lists_accepted(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_3f16acf1","line":241,"updated":"2015-03-31 15:34:08.000000000","message":"I\u0027d like to see a test that shows what happens (possibly warn) if you define the same values in the list for lval e.g.: {[\u0027d\u0027: 1}, {\u0027d\u0027:true}]\n\nWhat should be be response if you are looking that d is true in the policy? My assumption is it should fail, but it is not readily clear that that is the intent either in the code or via tests. \n\nIn either case this should be tested.","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":2218,"name":"Adam Young","email":"adam@younglogic.com","username":"ayoung"},"change_message_id":"e4d5fc39404e75c86223b7a1a01763fedd254ca0","unresolved":false,"context_lines":[{"line_number":238,"context_line":"        check \u003d _checks.GenericCheck(\u0027a.b.c.d\u0027, \u0027APPLES\u0027)"},{"line_number":239,"context_line":"        credentials \u003d {\u0027a\u0027: {\u0027b\u0027: [{\u0027c\u0027:"},{"line_number":240,"context_line":"                                    {\u0027d\u0027: [\u0027BANANAS\u0027, \u0027APPLES\u0027, \u0027GRAPES\u0027]}},"},{"line_number":241,"context_line":"                                   {}]}}"},{"line_number":242,"context_line":"        self.assertTrue(check({}, credentials, self.enforcer))"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"    def test_multiple_nested_lists_accepted(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_5be97fe5","line":241,"in_reply_to":"da9b358b_3f16acf1","updated":"2015-03-31 17:23:46.000000000","message":"So,  this would be legal, and I would expect it to succeed. \n\nFOr example, say I am looking for a Nova endpoint in the service catalog.  There would be multiple endpoint entries, only one of which would match.  But that should be sufficient to let the check pass.","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"a679a92805cfa9ea18b8075cba4491b9f9798aec","unresolved":false,"context_lines":[{"line_number":250,"context_line":"        self.assertTrue(check({}, credentials, self.enforcer))"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"    def test_entry_not_in_list_rejected(self):"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"        check \u003d _checks.GenericCheck(\u0027a.b.c.d\u0027, \u0027APPLES\u0027)"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"        credentials \u003d {\u0027a\u0027: {\u0027b\u0027: {\u0027c\u0027: {\u0027d\u0027: [\u0027PEACHES\u0027, \u0027PEARS\u0027]}}}}"}],"source_content_type":"text/x-python","patch_set":1,"id":"da9b358b_7c69e7bd","line":253,"updated":"2015-03-31 13:41:48.000000000","message":"ditto","commit_id":"72f11f915ab6881a423c2d549573265dfac75d0f"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"3f82ef64aba40eaffdb6744d35083e357b5ea9a5","unresolved":false,"context_lines":[{"line_number":264,"context_line":"        credentials \u003d {\u0027a\u0027: {\u0027b\u0027: [{\u0027a\u0027: \u0027\u0027},"},{"line_number":265,"context_line":"                                   {\u0027c\u0027:"},{"line_number":266,"context_line":"                                    {\u0027d\u0027: [\u0027BANANAS\u0027, \u0027APPLES\u0027, \u0027GRAPES\u0027]}},"},{"line_number":267,"context_line":"                                   {}]}}"},{"line_number":268,"context_line":"        self.assertTrue(check({}, credentials, self.enforcer))"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def test_entry_not_in_list_rejected(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa041b7_829b3372","line":267,"updated":"2015-04-03 05:46:35.000000000","message":"The test that is missing here is:\n    credentials \u003d {\u0027a\u0027: {\u0027b\u0027: [{\u0027a\u0027: \u0027\u0027}, {\u0027c\u0027: [\u0027somethingelse\u0027] }, {\u0027c\u0027: {\u0027d\u0027: [\u0027BANANAS\u0027, \u0027APPLES\u0027, \u0027GRAPES\u0027]}}, {}]}}\n\nsee the duplication of the \u0027c\u0027 in the list? This test/gap can be handled as a followup.","commit_id":"a08bc79f5c117696c43feb2e44c4dc5fd0013deb"}]}
