)]}'
{"oslo_policy/_checks.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7af9448242bb5cbe5e5e1a8ffcd21f3cc4ee6bc9","unresolved":false,"context_lines":[{"line_number":103,"context_line":"        Returns the logical inverse of the wrapped check."},{"line_number":104,"context_line":"        \"\"\""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        return not self.rule(target, cred, enforcer, current_rule)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"class AndCheck(BaseCheck):"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f515b1d_c5831b56","line":106,"updated":"2017-09-22 15:47:49.000000000","message":"I think we\u0027re going to need to factor out the inspection code and reuse it here.  We don\u0027t know what the rule we\u0027re not\u0027ing here is and if it\u0027s an external one that doesn\u0027t take a rule param it could break.\n\nThe same will apply to the And and Or checks too.","commit_id":"3a89be9c24a4033d858a6668cc6ba844d5aefc67"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"2495efb4d7d32f98385f3448cd0507639d887ae0","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        \"\"\""},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"        for rule in self.rules:"},{"line_number":125,"context_line":"            if not rule(target, cred, enforcer, current_rule):"},{"line_number":126,"context_line":"                return False"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f515b1d_45e60b19","line":125,"updated":"2017-09-22 15:57:20.000000000","message":"We can reuse the inspection code here, too, for the same reason as with NotCheck.","commit_id":"3a89be9c24a4033d858a6668cc6ba844d5aefc67"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"2495efb4d7d32f98385f3448cd0507639d887ae0","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        \"\"\""},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        for rule in self.rules:"},{"line_number":160,"context_line":"            if rule(target, cred, enforcer, current_rule):"},{"line_number":161,"context_line":"                return True"},{"line_number":162,"context_line":"        return False"},{"line_number":163,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"7f515b1d_e5ecd7f4","line":160,"updated":"2017-09-22 15:57:20.000000000","message":"And here as well.","commit_id":"3a89be9c24a4033d858a6668cc6ba844d5aefc67"},{"author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"change_message_id":"1420bb65dcb5365fb49eb9ec7aa21af7c7233a13","unresolved":false,"context_lines":[{"line_number":147,"context_line":"        Returns the logical inverse of the wrapped check."},{"line_number":148,"context_line":"        \"\"\""},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"        return not _check(self.rule, target, cred, enforcer, current_rule)"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"class AndCheck(BaseCheck):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_c4c1afe6","line":150,"range":{"start_line":150,"start_character":19,"end_line":150,"end_character":35},"updated":"2017-09-25 18:43:29.000000000","message":"Isn\u0027t this going to cause an infinite recursion?","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"8aff7176774284aedb88c42db31ccb074398a469","unresolved":false,"context_lines":[{"line_number":147,"context_line":"        Returns the logical inverse of the wrapped check."},{"line_number":148,"context_line":"        \"\"\""},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"        return not _check(self.rule, target, cred, enforcer, current_rule)"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"class AndCheck(BaseCheck):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_2408832a","line":150,"range":{"start_line":150,"start_character":19,"end_line":150,"end_character":35},"in_reply_to":"7f515b1d_c4c1afe6","updated":"2017-09-25 18:48:19.000000000","message":"NotCheck contains another rule, so this is checking that inner rule not re-checking self.","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"},{"author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"change_message_id":"ba54fe624430cea30e8f7a90083b4e48fea7ba8b","unresolved":false,"context_lines":[{"line_number":147,"context_line":"        Returns the logical inverse of the wrapped check."},{"line_number":148,"context_line":"        \"\"\""},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"        return not _check(self.rule, target, cred, enforcer, current_rule)"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"class AndCheck(BaseCheck):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_ff5e7810","line":150,"range":{"start_line":150,"start_character":19,"end_line":150,"end_character":35},"in_reply_to":"7f515b1d_c4c1afe6","updated":"2017-09-25 18:49:26.000000000","message":"OK, I think I see how this works now.","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"},{"author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"change_message_id":"1420bb65dcb5365fb49eb9ec7aa21af7c7233a13","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        \"\"\""},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"        for rule in self.rules:"},{"line_number":169,"context_line":"            if not _check(rule, target, cred, enforcer, current_rule):"},{"line_number":170,"context_line":"                return False"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_64b2fb96","line":169,"range":{"start_line":169,"start_character":26,"end_line":169,"end_character":30},"updated":"2017-09-25 18:43:29.000000000","message":"Same.","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"8aff7176774284aedb88c42db31ccb074398a469","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        \"\"\""},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"        for rule in self.rules:"},{"line_number":169,"context_line":"            if not _check(rule, target, cred, enforcer, current_rule):"},{"line_number":170,"context_line":"                return False"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_1f36f4e7","line":169,"range":{"start_line":169,"start_character":26,"end_line":169,"end_character":30},"in_reply_to":"7f515b1d_64b2fb96","updated":"2017-09-25 18:48:19.000000000","message":"Same.","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"}],"oslo_policy/policy.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"1086df8eca7c77a5e6e67e0822a774ed7b5e5777","unresolved":false,"context_lines":[{"line_number":736,"context_line":"        else:"},{"line_number":737,"context_line":"            try:"},{"line_number":738,"context_line":"                # Evaluate the rule"},{"line_number":739,"context_line":"                result \u003d self.rules[rule](target, creds, self, rule)"},{"line_number":740,"context_line":"            except KeyError:"},{"line_number":741,"context_line":"                LOG.debug(\u0027Rule [%s] does not exist\u0027, rule)"},{"line_number":742,"context_line":"                # If the rule doesn\u0027t exist, fail closed"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_28959b40","line":739,"updated":"2017-09-07 15:24:44.000000000","message":"This represents a breaking change to the API of the check class, because now we are always passing the new rule argument, but not all of the check classes accept the argument. We support checks that are implemented outside of oslo.policy, so it is not sufficient to update the library code, we also need to be careful to continue to support those other custom checks.\n\nTo do that, we can use the inspect module to look at the check class\u0027 __call__ method to see what arguments it takes, and only pass rule when the class wants it. Have a look at https://docs.python.org/2/library/inspect.html#inspect.getargspec for example, which should return enough information about the function to decide whether to pass rules.\n\nThe result should look something like this:\n\n  argspec \u003d inspect.getargspec(self.rules[rule])\n  args \u003d [target, crews, self]\n  if len(argspec.rules) \u003e 4:\n    # Only pass the rule name if the check class expects it.\n    args.append(rule)\n  self.rules[rule](*args)","commit_id":"ba5089dda31229b1eb4b503881cbc3ce268dd481"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"37883a0fed4ff325159aa6d04813a11327810ff3","unresolved":false,"context_lines":[{"line_number":736,"context_line":"        else:"},{"line_number":737,"context_line":"            try:"},{"line_number":738,"context_line":"                # Evaluate the rule"},{"line_number":739,"context_line":"                result \u003d self.rules[rule](target, creds, self, rule)"},{"line_number":740,"context_line":"            except KeyError:"},{"line_number":741,"context_line":"                LOG.debug(\u0027Rule [%s] does not exist\u0027, rule)"},{"line_number":742,"context_line":"                # If the rule doesn\u0027t exist, fail closed"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_c8705743","line":739,"in_reply_to":"7f287b81_28959b40","updated":"2017-09-07 15:25:53.000000000","message":"Oops, that may need to start:\n\n  argspec \u003d inspect.getargspec(self.rules[rule].__call__)","commit_id":"ba5089dda31229b1eb4b503881cbc3ce268dd481"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"3442e0ecb6eccb630cc8143821f2784ee74f5a64","unresolved":false,"context_lines":[{"line_number":736,"context_line":"        else:"},{"line_number":737,"context_line":"            try:"},{"line_number":738,"context_line":"                # Evaluate the rule"},{"line_number":739,"context_line":"                self.rule \u003d rule"},{"line_number":740,"context_line":"                result \u003d self.rules[rule](target, creds, self)"},{"line_number":741,"context_line":"            except KeyError:"},{"line_number":742,"context_line":"                LOG.debug(\u0027Rule [%s] does not exist\u0027, rule)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f2577a7_306fe6c6","line":739,"updated":"2017-09-08 14:35:25.000000000","message":"I don\u0027t think it\u0027s a good idea to store temporary global state on this object like this. It breaks thread-safe operation, for example.","commit_id":"b959a1390f4bc58ee342a627aea28c075d6f978c"},{"author":{"_account_id":26674,"name":"Thomas Duval","email":"thomas.duval@orange.com","username":"asteroide"},"change_message_id":"f5d665c58d9cb1c76a45a5e8ad16d1e4eb17d4d6","unresolved":false,"context_lines":[{"line_number":736,"context_line":"        else:"},{"line_number":737,"context_line":"            try:"},{"line_number":738,"context_line":"                # Evaluate the rule"},{"line_number":739,"context_line":"                self.rule \u003d rule"},{"line_number":740,"context_line":"                result \u003d self.rules[rule](target, creds, self)"},{"line_number":741,"context_line":"            except KeyError:"},{"line_number":742,"context_line":"                LOG.debug(\u0027Rule [%s] does not exist\u0027, rule)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f2577a7_d113e865","line":739,"in_reply_to":"5f2577a7_306fe6c6","updated":"2017-09-25 13:54:43.000000000","message":"Maybe, the content of the \"rule\" variable can be put in the target dictionary. I try to put the least changes in the code.","commit_id":"b959a1390f4bc58ee342a627aea28c075d6f978c"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"16a0e036057118a7b015dd4acc3e9a82a59d4ca3","unresolved":false,"context_lines":[{"line_number":737,"context_line":"        else:"},{"line_number":738,"context_line":"            try:"},{"line_number":739,"context_line":"                # Evaluate the rule"},{"line_number":740,"context_line":"                LOG.warning(\"self.rules[rule] {}\".format(self.rules[rule]))"},{"line_number":741,"context_line":"                LOG.warning(\"type {}\".format(type(self.rules[rule])))"},{"line_number":742,"context_line":"                argspec \u003d inspect.getargspec(self.rules[rule].__call__)"},{"line_number":743,"context_line":"                _args \u003d [target, creds, self]"}],"source_content_type":"text/x-python","patch_set":4,"id":"5f2577a7_fc569e06","line":740,"updated":"2017-09-12 11:18:14.000000000","message":"This is OK for debugging, but before we approve the patch we will need to remove the logging calls.","commit_id":"581776e5c9051d82b5b2694f0a2c024b88c75773"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"16a0e036057118a7b015dd4acc3e9a82a59d4ca3","unresolved":false,"context_lines":[{"line_number":740,"context_line":"                LOG.warning(\"self.rules[rule] {}\".format(self.rules[rule]))"},{"line_number":741,"context_line":"                LOG.warning(\"type {}\".format(type(self.rules[rule])))"},{"line_number":742,"context_line":"                argspec \u003d inspect.getargspec(self.rules[rule].__call__)"},{"line_number":743,"context_line":"                _args \u003d [target, creds, self]"},{"line_number":744,"context_line":"                LOG.warning(\"argspec {}\".format(argspec))"},{"line_number":745,"context_line":"                LOG.warning(\"argspec.args {}\".format(argspec.args))"},{"line_number":746,"context_line":"                # Check if the rule argument must be included or not"}],"source_content_type":"text/x-python","patch_set":4,"id":"5f2577a7_5c47f24c","line":743,"updated":"2017-09-12 11:18:14.000000000","message":"args is a local variable, so there is no need to use a _ prefix to indicate that it is private.","commit_id":"581776e5c9051d82b5b2694f0a2c024b88c75773"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"cb149adc6b0cf7b5c8c8b56b12edb8e1b0b7fb0d","unresolved":false,"context_lines":[{"line_number":748,"context_line":"                LOG.debug(\u0027Rule [%s] does not exist\u0027, rule)"},{"line_number":749,"context_line":"                # If the rule doesn\u0027t exist, fail closed"},{"line_number":750,"context_line":"                result \u003d False"},{"line_number":751,"context_line":"            else:"},{"line_number":752,"context_line":"                result \u003d _checks._check("},{"line_number":753,"context_line":"                    rule\u003dto_check,"},{"line_number":754,"context_line":"                    target\u003dtarget,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_9f41c40e","line":751,"updated":"2017-09-25 18:53:13.000000000","message":"If the cinder tests continue to fail, I will pull this call back up into the try:except block on line 746.","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"}],"oslo_policy/tests/test_checks.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"3ce3b21212e1a50d6f555233c4edb2fc6d550345","unresolved":false,"context_lines":[{"line_number":189,"context_line":""},{"line_number":190,"context_line":"        last_request \u003d self.requests_mock.last_request"},{"line_number":191,"context_line":"        self.assertEqual(\u0027POST\u0027, last_request.method)"},{"line_number":192,"context_line":"        print(\"-----------------------------------------\")"},{"line_number":193,"context_line":"        print(last_request.body)"},{"line_number":194,"context_line":"        print(\"-----------------------------------------\")"},{"line_number":195,"context_line":"        self.assertEqual(dict(target\u003dtarget_dict, credentials\u003dcred_dict,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_7bd14efb","line":192,"updated":"2017-09-26 21:50:05.000000000","message":"Should probably remove these.","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"3ce3b21212e1a50d6f555233c4edb2fc6d550345","unresolved":false,"context_lines":[{"line_number":488,"context_line":"                results.append((target, cred, enforcer, current_rule))"},{"line_number":489,"context_line":"                return False"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":"        check \u003d _checks.AndCheck([TestCheck()])"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"        self.assertFalse(check(\u0027target\u0027, \u0027cred\u0027, None, current_rule\u003d\"a_rule\"))"},{"line_number":494,"context_line":"        self.assertEqual("}],"source_content_type":"text/x-python","patch_set":9,"id":"7f515b1d_fbc77e11","line":491,"updated":"2017-09-26 21:50:05.000000000","message":"Not sure an AndCheck with only one rule makes sense, but since it works and we\u0027re only testing its call of the nested rule I guess it\u0027s okay. :-)","commit_id":"4eef35e5463c1bfc23e90865efcba315671f41a6"}]}
