)]}'
{"ceilometer/api/controllers/v2.py":[{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"140263c42388c365172f107619767b1952a13f10","unresolved":false,"context_lines":[{"line_number":210,"context_line":"        return converted_value"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"def _sanitize_query(q, valid_keys):"},{"line_number":214,"context_line":"    \u0027\u0027\u0027Check the query to see if:"},{"line_number":215,"context_line":"    1) the request is comming from admin - then allow full visibility"},{"line_number":216,"context_line":"    2) non-admin - make sure that the query includes the requester\u0027s"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FdJ8%3D","line":213,"updated":"2013-09-04 15:28:47.000000000","message":"This method is complex enough to have its own set of tests. Hiding this functionality in other tests is getting complex to follow.","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"ea3cf4058fb3f89edfaad72ae5abec9d43c378e1","unresolved":false,"context_lines":[{"line_number":218,"context_line":"    \u0027\u0027\u0027"},{"line_number":219,"context_line":"    auth_project \u003d acl.get_limited_to_project(pecan.request.headers)"},{"line_number":220,"context_line":"    if auth_project:"},{"line_number":221,"context_line":"        proj_q \u003d [i for i in q if i.field \u003d\u003d \u0027project_id\u0027]"},{"line_number":222,"context_line":"        for i in proj_q:"},{"line_number":223,"context_line":"            if auth_project !\u003d i.value or i.op !\u003d \u0027eq\u0027:"},{"line_number":224,"context_line":"                # TODO(asalkeld) in the next version of wsme (0.5b3+)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FgTA%3D","line":221,"updated":"2013-09-04 00:42:23.000000000","message":"Shouldn\u0027t this also look for i.field \u003d\u003d \u0027on_behalf_of\u0027?","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"ea3cf4058fb3f89edfaad72ae5abec9d43c378e1","unresolved":false,"context_lines":[{"line_number":230,"context_line":"                                                                     i.value)"},{"line_number":231,"context_line":"                raise wsme.exc.ClientSideError(errstr)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"        if not proj_q and \u0027on_behalf_of\u0027 not in valid_keys:"},{"line_number":234,"context_line":"            # The user is restricted, but they didn\u0027t specify a project"},{"line_number":235,"context_line":"            # so add it for them."},{"line_number":236,"context_line":"            q.append(Query(field\u003d\u0027project_id\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FgT8%3D","line":233,"updated":"2013-09-04 00:42:23.000000000","message":"If I am restricted and I specify on_behalf_of for some other project, what is detecting that and refusing the query?","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"52d833d27a6ab8ceaa876e9639c76435b0f4bb41","unresolved":false,"context_lines":[{"line_number":230,"context_line":"                                                                     i.value)"},{"line_number":231,"context_line":"                raise wsme.exc.ClientSideError(errstr)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"        if not proj_q and \u0027on_behalf_of\u0027 not in valid_keys:"},{"line_number":234,"context_line":"            # The user is restricted, but they didn\u0027t specify a project"},{"line_number":235,"context_line":"            # so add it for them."},{"line_number":236,"context_line":"            q.append(Query(field\u003d\u0027project_id\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FdBc%3D","line":233,"in_reply_to":"AAAASn%2F%2FdSw%3D","updated":"2013-09-04 15:44:51.000000000","message":"ah, got it. totally misunderstood what on_behalf_of was then. thanks for the explanation eglynn.","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"fd2fbbed1853989a0e5e43ea23cb4bcdd2f88154","unresolved":false,"context_lines":[{"line_number":230,"context_line":"                                                                     i.value)"},{"line_number":231,"context_line":"                raise wsme.exc.ClientSideError(errstr)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"        if not proj_q and \u0027on_behalf_of\u0027 not in valid_keys:"},{"line_number":234,"context_line":"            # The user is restricted, but they didn\u0027t specify a project"},{"line_number":235,"context_line":"            # so add it for them."},{"line_number":236,"context_line":"            q.append(Query(field\u003d\u0027project_id\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FdSw%3D","line":233,"in_reply_to":"AAAASn%2F%2FdhU%3D","updated":"2013-09-04 15:06:39.000000000","message":"@gorc: the idea is that there are potentially two tenants associated with an alarm state transition .. the change is initiated by the tenant associated with the ceilometer service evaluating the alarms against threshold, but this change is effected on behalf of the alarm\u0027s owner.\n\nSo if the owner comes along and accesses alarm history, they should have visibility to two different types of events:\n\n* events they initiated themselves (creation, rule changes, deletion)\n* events initiated on their behalf by the alarming system (state transitions)\n\nThe on_behalf_of field is the common element there. While the project_id may be set to different tenants, depending on who initiated the change, the alarm\u0027s owner should have visibility to both.\n\nHence we require that for non-admin users, the on_behalf_of field is constrained for the downcall into the DB layer, to the authenticated project_id associated with the API call.","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"e22fc975b636601ecb7c65e0b38f5d4494504c65","unresolved":false,"context_lines":[{"line_number":230,"context_line":"                                                                     i.value)"},{"line_number":231,"context_line":"                raise wsme.exc.ClientSideError(errstr)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"        if not proj_q and \u0027on_behalf_of\u0027 not in valid_keys:"},{"line_number":234,"context_line":"            # The user is restricted, but they didn\u0027t specify a project"},{"line_number":235,"context_line":"            # so add it for them."},{"line_number":236,"context_line":"            q.append(Query(field\u003d\u0027project_id\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FdbQ%3D","line":233,"in_reply_to":"AAAASn%2F%2FgT8%3D","updated":"2013-09-04 14:50:52.000000000","message":"The on_behalf_of field was intended as a field for internal use only. I had thought a neat way of ensuring that was to make it a non-keyword arg on the corresponding DB accessor method (get_alarm_changes in this case), and then always set that arg explicitly in the call down to the storage driver.\n\nHowever I see now that while this prevents on_behalf_of being explicitly constrained by the caller via a query parameter in the API call (as intended), but it does so in a very messy way, i.e. the API service fails with:\n\n  500 Internal Server Error\n  ... \"faultstring\": \"get_alarm_changes() got multiple values for keyword argument \u0027on_behalf_of\u0027\"\n\nClearly that exposes unnecessary internal implementation detail to the caller, no need for such washing of dirty linen in public ;)\n\nSo instead I would propose to add an explicit way of excluding certain DB accessor fields from the valid keys. Would that be acceptable?","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"a52d49e64272e61d624b419289bf0126960d664a","unresolved":false,"context_lines":[{"line_number":230,"context_line":"                                                                     i.value)"},{"line_number":231,"context_line":"                raise wsme.exc.ClientSideError(errstr)"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"        if not proj_q and \u0027on_behalf_of\u0027 not in valid_keys:"},{"line_number":234,"context_line":"            # The user is restricted, but they didn\u0027t specify a project"},{"line_number":235,"context_line":"            # so add it for them."},{"line_number":236,"context_line":"            q.append(Query(field\u003d\u0027project_id\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FdhU%3D","line":233,"in_reply_to":"AAAASn%2F%2FgT8%3D","updated":"2013-09-04 14:28:58.000000000","message":"i\u0027m probably misunderstand on_behalf_of here but my understanding is this is something relating to trust. the current user is acting on project_id (which it should have authorization for) on behalf of another project (which it doesn\u0027t necessarily need  to be a member of).  i\u0027m not sure what the design expected here is.","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"059155bda246a3497754bdc9079ba5e71a484b8e","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    if keys and excluded:"},{"line_number":244,"context_line":"        for key in excluded:"},{"line_number":245,"context_line":"            if key in keys:"},{"line_number":246,"context_line":"                keys.remove(key)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"def _query_to_kwargs(query, db_func, internal_keys\u003d[]):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAASn%2F%2FbxY%3D","line":246,"updated":"2013-09-04 19:47:26.000000000","message":"this seems like it could work so we don\u0027t need function:\n[keys.remove(key) for key in excluded if key in keys]","commit_id":"c0c2b844a7ac0edb0c7c937fbe9c8646d8a24efb"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"a7c1fe4f34ddb0868fbc3343184946554dbec201","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    if keys and excluded:"},{"line_number":244,"context_line":"        for key in excluded:"},{"line_number":245,"context_line":"            if key in keys:"},{"line_number":246,"context_line":"                keys.remove(key)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"def _query_to_kwargs(query, db_func, internal_keys\u003d[]):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAASn%2F%2Fbow%3D","line":246,"in_reply_to":"AAAASn%2F%2FbuI%3D","updated":"2013-09-04 20:09:08.000000000","message":"I think you won.","commit_id":"c0c2b844a7ac0edb0c7c937fbe9c8646d8a24efb"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"701233654a58f7c97d09e30aaf21448231df7dee","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    if keys and excluded:"},{"line_number":244,"context_line":"        for key in excluded:"},{"line_number":245,"context_line":"            if key in keys:"},{"line_number":246,"context_line":"                keys.remove(key)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"def _query_to_kwargs(query, db_func, internal_keys\u003d[]):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAASn%2F%2FbuI%3D","line":246,"in_reply_to":"AAAASn%2F%2FbxY%3D","updated":"2013-09-04 20:05:38.000000000","message":"It doesn\u0027t look like we care what order the keys are in, so:\n\n  set(keys) - set(excluded)","commit_id":"c0c2b844a7ac0edb0c7c937fbe9c8646d8a24efb"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"bf685bb5120d6080da974c2389a70f162a5313d7","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    if keys and excluded:"},{"line_number":244,"context_line":"        for key in excluded:"},{"line_number":245,"context_line":"            if key in keys:"},{"line_number":246,"context_line":"                keys.remove(key)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"def _query_to_kwargs(query, db_func, internal_keys\u003d[]):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAASn%2F%2FbvE%3D","line":246,"in_reply_to":"AAAASn%2F%2FbxY%3D","updated":"2013-09-04 19:54:54.000000000","message":"Or:\n\nfilter(lambda key: key not in excluded, keys)","commit_id":"c0c2b844a7ac0edb0c7c937fbe9c8646d8a24efb"}],"tests/api/v2/test_alarm_scenarios.py":[{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"140263c42388c365172f107619767b1952a13f10","unresolved":false,"context_lines":[{"line_number":332,"context_line":"        history \u003d self._get_alarm_history(alarm, query\u003dquery)"},{"line_number":333,"context_line":"        self.assertEqual(0, len(history))"},{"line_number":334,"context_line":"        query[\u0027op\u0027] \u003d \u0027le\u0027"},{"line_number":335,"context_line":"        history \u003d self._get_alarm_history(alarm, query\u003dquery)"},{"line_number":336,"context_line":"        self.assertEqual(1, len(history))"},{"line_number":337,"context_line":"        detail \u003d \u0027{\"name\": \"renamed\"}\u0027"},{"line_number":338,"context_line":"        self._assert_is_subset(dict(alarm_id\u003dalarm[\u0027alarm_id\u0027],"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAASn%2F%2FdMA%3D","line":335,"updated":"2013-09-04 15:28:47.000000000","message":"This is 3-4 tests. A test should do one thing and the name should reflect what it\u0027s testing.","commit_id":"061b5e3467acf8e8e9d727382f27af6a4425e9fb"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"059155bda246a3497754bdc9079ba5e71a484b8e","unresolved":false,"context_lines":[{"line_number":389,"context_line":"                                    type\u003d\u0027rule change\u0027,"},{"line_number":390,"context_line":"                                    user_id\u003dalarm[\u0027user_id\u0027]),"},{"line_number":391,"context_line":"                               history[0])"},{"line_number":392,"context_line":"        alarm \u003d self._get_alarm(\u0027a\u0027)"},{"line_number":393,"context_line":"        self.delete(\u0027/alarms/%s\u0027 % alarm[\u0027alarm_id\u0027],"},{"line_number":394,"context_line":"                    headers\u003dself.auth_headers,"},{"line_number":395,"context_line":"                    status\u003d200)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAASn%2F%2Fb2E%3D","line":392,"updated":"2013-09-04 19:47:26.000000000","message":"this second part seems like it could be broken into separate test","commit_id":"c0c2b844a7ac0edb0c7c937fbe9c8646d8a24efb"}]}
