)]}'
{"neutron/tests/unit/conf/policies/test_service_type.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"61d3018d6d852cb51c567446af4cab8056a85f4b","unresolved":true,"context_lines":[{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def setUp(self):"},{"line_number":55,"context_line":"        super(ProjectAdminTests, self).setUp()"},{"line_number":56,"context_line":"        self.context \u003d self.project_admin_ctx"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class ProjectMemberTests(ProjectAdminTests):"}],"source_content_type":"text/x-python","patch_set":1,"id":"181c54c9_e06610c9","line":56,"updated":"2021-04-08 21:22:54.000000000","message":"I think we can get these tests passing by either ensuring the target contains a project_id in the target, or by changing the default rule to something like:\n\n  policy.DocumentedRuleDefault(\n    name\u003d\u0027get_service_provider\u0027,\n    check_str\u003d\u0027role:reader\u0027,\n    scope_types\u003d[\u0027system\u0027, \u0027project\u0027],\n    ...\n  )\n\nWe might consider removing the scope from the check string since we\u0027re offloading scope enforcement to oslo.policy via scope_types. The downside of this approach is that it requires a change to the policy, which we already shipped in Wallaby. Maybe this isn\u0027t much of a concern since the old policy exposed this API to everyone.\n\nThe other alternative would be to populate the project_id in the target, even if it doesn\u0027t make sense. This pattern is used elsewhere and it\u0027s a noop to get around situations like this.\n\n  # somewhere in neutron\u0027s API code\n  target \u003d {\u0027project_id\u0027: request.context.get(\u0027project_id\u0027, None)}\n  policy.enforce(context, \u0027get_service_provider\u0027, target)","commit_id":"720bd652171342dac3e0ace6241f78fcd13d2449"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"88f20d4f0c1e72d3f65ace5f0686e5f8e64631c5","unresolved":true,"context_lines":[{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def setUp(self):"},{"line_number":55,"context_line":"        super(ProjectAdminTests, self).setUp()"},{"line_number":56,"context_line":"        self.context \u003d self.project_admin_ctx"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class ProjectMemberTests(ProjectAdminTests):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3e51d5e5_48339aea","line":56,"in_reply_to":"181c54c9_e06610c9","updated":"2021-04-12 14:55:50.000000000","message":"Thx, change the check_str is good approach IMO. And it works fine. Adding project_id in target isn\u0027t good IMO as real service type resource will not have project_id so it won\u0027t be the same.","commit_id":"720bd652171342dac3e0ace6241f78fcd13d2449"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"70b626b8a32cd52897f5a1f56f8a9a1ff6c3e8e5","unresolved":false,"context_lines":[{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def setUp(self):"},{"line_number":55,"context_line":"        super(ProjectAdminTests, self).setUp()"},{"line_number":56,"context_line":"        self.context \u003d self.project_admin_ctx"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class ProjectMemberTests(ProjectAdminTests):"}],"source_content_type":"text/x-python","patch_set":1,"id":"42272f0d_4281b4a3","line":56,"in_reply_to":"3e51d5e5_48339aea","updated":"2021-04-12 18:19:12.000000000","message":"Ok - that sounds good.","commit_id":"720bd652171342dac3e0ace6241f78fcd13d2449"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"788b54bd3652dddfab7d9faf0f328c52ac0a3b63","unresolved":true,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"    def setUp(self):"},{"line_number":23,"context_line":"        super(ServiceTypeAPITestCase, self).setUp()"},{"line_number":24,"context_line":"        self.target \u003d {}"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"class SystemAdminTests(ServiceTypeAPITestCase):"}],"source_content_type":"text/x-python","patch_set":2,"id":"c0deefbc_d0d848be","line":24,"updated":"2021-04-12 18:24:52.000000000","message":"This target will actually contain the service provider reference, right? Or will it be empty in the real world?","commit_id":"7808351a602937bb31db89686ccbc4c41b9c23df"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"786fc3731ef08783ed16e36f236ed220c438351d","unresolved":true,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"    def setUp(self):"},{"line_number":23,"context_line":"        super(ServiceTypeAPITestCase, self).setUp()"},{"line_number":24,"context_line":"        self.target \u003d {}"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"class SystemAdminTests(ServiceTypeAPITestCase):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffb09e69_e6ef2789","line":24,"in_reply_to":"c0deefbc_d0d848be","updated":"2021-04-15 07:02:41.000000000","message":"yes, but any of the attributes there is involved in the policy check so I didn\u0027t bother to prepare them here.","commit_id":"7808351a602937bb31db89686ccbc4c41b9c23df"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"244d49e320d51b11d93719de43fa79aaaa82c859","unresolved":true,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"    def setUp(self):"},{"line_number":23,"context_line":"        super(ServiceTypeAPITestCase, self).setUp()"},{"line_number":24,"context_line":"        self.target \u003d {}"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"class SystemAdminTests(ServiceTypeAPITestCase):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ec4025d9_ee1a5f90","line":24,"in_reply_to":"ffb09e69_e6ef2789","updated":"2021-04-21 18:54:10.000000000","message":"So service providers don\u0027t have project_ids?\n\nhttps://github.com/openstack/neutron/blob/master/neutron/conf/policies/service_type.py#L25","commit_id":"7808351a602937bb31db89686ccbc4c41b9c23df"}]}
