)]}'
{"doc/source/usage.rst":[{"author":{"_account_id":5638,"name":"Davanum Srinivas","email":"davanum@gmail.com","username":"dims-v"},"change_message_id":"e26f61743149ac59ec44fe4c9c5b6a88d29562b9","unresolved":false,"context_lines":[{"line_number":96,"context_line":"where list_policies is a method that returns a list of policy.RuleDefault"},{"line_number":97,"context_line":"objects."},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"Run the olso-policy-sample-generator script with some configuration options::"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    oslo-policy-sample-generator --namespace nova.api --namespace nova.compute.api --output-file policy-sample.yaml"},{"line_number":102,"context_line":""}],"source_content_type":"text/x-rst","patch_set":8,"id":"bab6814e_7de8f27c","line":99,"updated":"2016-05-25 16:33:16.000000000","message":"olso -\u003e oslo :)","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"}],"oslo_policy/generator.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":55,"context_line":"    :param description: A string with helpful text."},{"line_number":56,"context_line":"    :returns: A line wrapped comment, or blank comment if description is None"},{"line_number":57,"context_line":"    \"\"\""},{"line_number":58,"context_line":"    if description is None:"},{"line_number":59,"context_line":"        return \u0027#\u0027"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    return \u0027\\n\u0027.join(textwrap.wrap(description, 70, initial_indent\u003d\u0027# \u0027,"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_c25db516","line":58,"updated":"2016-05-25 18:49:12.000000000","message":"If the description is an empty string we probably want to do the same thing.\n\n  if not description:\n    return \u0027#\u0027","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":58,"context_line":"    if description is None:"},{"line_number":59,"context_line":"        return \u0027#\u0027"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    return \u0027\\n\u0027.join(textwrap.wrap(description, 70, initial_indent\u003d\u0027# \u0027,"},{"line_number":62,"context_line":"                                   subsequent_indent\u003d\u0027# \u0027,"},{"line_number":63,"context_line":"                                   break_long_words\u003dFalse,"},{"line_number":64,"context_line":"                                   replace_whitespace\u003dFalse))"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_02ecdd27","line":61,"updated":"2016-05-25 18:49:12.000000000","message":"Use textwrap.fill() instead of doing the join yourself.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":93,"context_line":"                                section2: [rule_default_3]}"},{"line_number":94,"context_line":"    \"\"\""},{"line_number":95,"context_line":"    # Python3 returns a view for .keys() so we need to iterate it"},{"line_number":96,"context_line":"    sections \u003d [key for key in policies.keys()]"},{"line_number":97,"context_line":"    sections.sort()"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    for section in sections:"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_272c9349","line":96,"updated":"2016-05-25 18:49:12.000000000","message":"These 2 lines can be collapsed to\n\n  sections \u003d sorted(policies.keys())\n\nThat probably even fits inline in the for loop start.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":100,"context_line":"        rule_defaults \u003d policies[section]"},{"line_number":101,"context_line":"        section_text_list \u003d []"},{"line_number":102,"context_line":"        for rule_default in rule_defaults:"},{"line_number":103,"context_line":"            section_text_list.append("},{"line_number":104,"context_line":"                _format_rule_default_yaml(rule_default,"},{"line_number":105,"context_line":"                                          include_help\u003dinclude_help))"},{"line_number":106,"context_line":"        yield \u0027\u0027.join(section_text_list)"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_c7eca7f5","line":103,"updated":"2016-05-25 18:49:12.000000000","message":"If it\u0027s not important for this function to yield a whole section each time, this internal list could be replaced with a yield statement here and you could avoid iterating over the results in the join below (because it would go away).","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        output_file.write(section)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def generate_policy(enforcer, output_file\u003dNone):"},{"line_number":130,"context_line":"    \"\"\"Generate a policy file showing what will be used."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    This takes all registered policies and merges them with what\u0027s defined in"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_4786f7db","line":129,"updated":"2016-05-25 18:49:12.000000000","message":"This function isn\u0027t used. Please add it in a different patch where it\u0027s tied fully into the new app.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"1bbb733a5afc000921dbb464d17fc3a008a55989","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        output_file.write(section)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def generate_policy(enforcer, output_file\u003dNone):"},{"line_number":130,"context_line":"    \"\"\"Generate a policy file showing what will be used."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    This takes all registered policies and merges them with what\u0027s defined in"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_c660ff37","line":129,"in_reply_to":"bab6814e_038039be","updated":"2016-05-26 13:57:30.000000000","message":"OK, I think the pattern of defining an entry point to return the thing that the common tool needs is better. It gives users one program to interact with, and is less work for project teams and packagers.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"8391b1552f7eeb7eef5f6fa3e999c54be3052d2b","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        output_file.write(section)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def generate_policy(enforcer, output_file\u003dNone):"},{"line_number":130,"context_line":"    \"\"\"Generate a policy file showing what will be used."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    This takes all registered policies and merges them with what\u0027s defined in"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_c996794b","line":129,"in_reply_to":"bab6814e_4786f7db","updated":"2016-05-25 20:49:30.000000000","message":"This function will not be used by oslo.policy. Because it relies on a configured oslo_policy.policy.Enforcer to be passed in it is expected that projects consuming oslo.policy will call this since there is not a common configuration.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"d5f6499c1f4d1c4578b72fa409364cd57eb38b08","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        output_file.write(section)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def generate_policy(enforcer, output_file\u003dNone):"},{"line_number":130,"context_line":"    \"\"\"Generate a policy file showing what will be used."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    This takes all registered policies and merges them with what\u0027s defined in"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_038039be","line":129,"in_reply_to":"bab6814e_740e408d","updated":"2016-05-26 13:39:38.000000000","message":"Generating default policy will be handled by \u0027generate_sample\u0027 above. That is solely dependent on entry points, namespaces, and policy registration. I suppose that could be more appropriately named but sample/default are interchangeable in my head.\n\ngenerate_policy generates the actual used policy in the project, which is based on the Enforcer.rules dict. And Enforcer.rules is a merging of Enforcer.file_rules and Enforcer.registered_rules. But because Enforcer.file_rules is dependent on which policy files a project chooses to load I thought it best to let each project construct an Enforcer that matches what they use in practice and then pass that in here to generate a sample.\n\nSo it\u0027s a question of whether projects should be asked to create a method and entry point which returns an Enforcer object configured to their liking, or write a small cli which calls this method. I can go either way, but this seemed simpler to me.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"c8248875642d626ff9937893ee918155f5d79932","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        output_file.write(section)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def generate_policy(enforcer, output_file\u003dNone):"},{"line_number":130,"context_line":"    \"\"\"Generate a policy file showing what will be used."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    This takes all registered policies and merges them with what\u0027s defined in"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_d98460d4","line":129,"in_reply_to":"bab6814e_c660ff37","updated":"2016-05-26 14:10:44.000000000","message":"Okay. That\u0027s on the next patch in this series now, but I will update it.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"08684ed9e9b01c016f114c383324f8d328314bc1","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        output_file.write(section)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def generate_policy(enforcer, output_file\u003dNone):"},{"line_number":130,"context_line":"    \"\"\"Generate a policy file showing what will be used."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    This takes all registered policies and merges them with what\u0027s defined in"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_740e408d","line":129,"in_reply_to":"bab6814e_c996794b","updated":"2016-05-25 21:30:12.000000000","message":"So each project is going to have to have its own command line program to generate a default policy? That doesn\u0027t seem optimal, and is why I wanted the generator plugin entry points to return data that could be used directly. Can we make a single command that takes the namespaces as input and registers the policies itself or something?","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        output_file.write(section)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"def generate_matches(enforcer):"},{"line_number":158,"context_line":"    \"\"\"Generate a list of configured policies which match defaults."},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    This checks all policies loaded from policy files and checks to see if they"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_e7772b00","line":157,"updated":"2016-05-25 18:49:12.000000000","message":"This function isn\u0027t used. Please add it in a different patch where it\u0027s tied fully into the new app.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"8391b1552f7eeb7eef5f6fa3e999c54be3052d2b","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        output_file.write(section)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"def generate_matches(enforcer):"},{"line_number":158,"context_line":"    \"\"\"Generate a list of configured policies which match defaults."},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    This checks all policies loaded from policy files and checks to see if they"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_09740134","line":157,"in_reply_to":"bab6814e_e7772b00","updated":"2016-05-25 20:49:30.000000000","message":"Same as above. I will split these out into separate patches, but consumers of these methods will not appear until this code is in a release of oslo.policy.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":172,"context_line":"    for name, file_opt in enforcer.file_rules.items():"},{"line_number":173,"context_line":"        reg_rule \u003d enforcer.registered_rules.get(name, None)"},{"line_number":174,"context_line":"        if reg_rule:"},{"line_number":175,"context_line":"            if str(file_opt.check) \u003d\u003d str(reg_rule.check):"},{"line_number":176,"context_line":"                matches.append(reg_rule)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    return matches"}],"source_content_type":"text/x-python","patch_set":8,"id":"bab6814e_222641ba","line":175,"updated":"2016-05-25 18:49:12.000000000","message":"We should probably just add comparison methods to RuleDefault to avoid having the generator have to know to do the str() conversion on the check attribute.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"}],"setup.cfg":[{"author":{"_account_id":5638,"name":"Davanum Srinivas","email":"davanum@gmail.com","username":"dims-v"},"change_message_id":"e26f61743149ac59ec44fe4c9c5b6a88d29562b9","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"console_scripts \u003d"},{"line_number":34,"context_line":"    oslopolicy-checker \u003d oslo_policy.shell:main"},{"line_number":35,"context_line":"    oslo-policy-sample-generator \u003d oslo_policy.generator:main"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":""}],"source_content_type":"text/x-ttcn-cfg","patch_set":8,"id":"bab6814e_dd711e46","line":35,"updated":"2016-05-25 16:33:16.000000000","message":"follow pattern above? \"oslopolicy-sample-generator\" (drop the -)","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"7f5b140a4ac24546c4dcb891b8207834a6127675","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"console_scripts \u003d"},{"line_number":34,"context_line":"    oslopolicy-checker \u003d oslo_policy.shell:main"},{"line_number":35,"context_line":"    oslo-policy-sample-generator \u003d oslo_policy.generator:main"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":""}],"source_content_type":"text/x-ttcn-cfg","patch_set":8,"id":"bab6814e_c7bf87a8","line":35,"in_reply_to":"bab6814e_dd711e46","updated":"2016-05-25 18:49:12.000000000","message":"I agree.","commit_id":"714980c1cc94661fc55d9bbf4504a5b1cdaed665"}]}
