)]}'
{"nova/api/openstack/compute/contrib/instance_actions.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"85c7bb4893a15ff415bcaf0cf34e34601c0f95ad","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def get_controller_extensions(self):"},{"line_number":147,"context_line":"        ext \u003d extensions.ControllerExtension(self, \u0027os-instance-actions\u0027,"},{"line_number":148,"context_line":"                                             InstanceActionEventsController())"},{"line_number":149,"context_line":"        return [ext]"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2FG4Q%3D","line":148,"updated":"2013-02-06 23:02:45.000000000","message":"Wait, so we\u0027re extending the controller that we ourselves have just registered?  I don\u0027t like this concept; I would rather see the behavior built in.  It\u0027s not like the user can turn off the extension behavior, after all…","commit_id":"5a4ba4ee0b78cde56eb4d3c430ace292f0ab48e4"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"c5fc541f062ee18cf98712338aa0c5da2951b6af","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def get_controller_extensions(self):"},{"line_number":147,"context_line":"        ext \u003d extensions.ControllerExtension(self, \u0027os-instance-actions\u0027,"},{"line_number":148,"context_line":"                                             InstanceActionEventsController())"},{"line_number":149,"context_line":"        return [ext]"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2FDjA%3D","line":148,"in_reply_to":"AAAAM3%2F%2FFVE%3D","updated":"2013-02-08 19:21:53.000000000","message":"That was exactly what I needed, thanks.","commit_id":"5a4ba4ee0b78cde56eb4d3c430ace292f0ab48e4"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"74c29a409d44a83d56f6baf1b83d54550891538b","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def get_controller_extensions(self):"},{"line_number":147,"context_line":"        ext \u003d extensions.ControllerExtension(self, \u0027os-instance-actions\u0027,"},{"line_number":148,"context_line":"                                             InstanceActionEventsController())"},{"line_number":149,"context_line":"        return [ext]"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2FGXs%3D","line":148,"in_reply_to":"AAAAM3%2F%2FG4Q%3D","updated":"2013-02-07 03:11:15.000000000","message":"The motivation for this was that \u0027events\u0027 shouldn\u0027t be returned as part of an action if policy does not allow it.  I didn\u0027t require an admin context but the suggested setup will be that only admins can see events.  \n\nAnd I could not figure out how to get the XML serialization to work with an optional key in the returned object.  If I could figure out how to do XML serialization both with and without \u0027event\u0027s as part of the \u0027instanceAction\u0027 return on line 87 I would much rather not have this extension, but the innards of the XML generation were beyond my understanding.","commit_id":"5a4ba4ee0b78cde56eb4d3c430ace292f0ab48e4"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"e4aa092ae0b4d04f5b9dbc0671bb118578095e78","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def get_controller_extensions(self):"},{"line_number":147,"context_line":"        ext \u003d extensions.ControllerExtension(self, \u0027os-instance-actions\u0027,"},{"line_number":148,"context_line":"                                             InstanceActionEventsController())"},{"line_number":149,"context_line":"        return [ext]"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2FFVE%3D","line":148,"in_reply_to":"AAAAM3%2F%2FGXs%3D","updated":"2013-02-07 17:41:59.000000000","message":"OK, I can understand that…\n\nAs for optional elements—the simplest approach might be to just insert an empty value when the events can\u0027t be included due to policy.  However, there are ways of excluding an element; as an example, check out nova/api/compute/versions.py and see the MediaTypesTemplateElement, which has exactly the behavior you want.  The operative behavior here is the override of the will_render() method, which determines when the element is rendered.  Note that you will have to use the elem.append() pattern instead of xmlutil.SubTemplateElement() to insert it into your XML (see make_version()); xmlutil.SubTemplateElement() is just a handy shortcut.\n\n(I should also point out that the will_render() method, by default, returns True only when the datum is not None, so that could be another way of structuring your data.)","commit_id":"5a4ba4ee0b78cde56eb4d3c430ace292f0ab48e4"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"df4308534b6b3f6f81442a0f18db3c79a0779d03","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            events \u003d []"},{"line_number":109,"context_line":"            for event in events_raw:"},{"line_number":110,"context_line":"                events.append(self._format_event(event))"},{"line_number":111,"context_line":"            action[\u0027events\u0027] \u003d events"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"        return {\u0027instanceAction\u0027: action}"},{"line_number":114,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAM3%2F%2FDgs%3D","line":111,"updated":"2013-02-08 19:35:47.000000000","message":"Suggestion: You should be able to condense the 4 line above to:\n\n    action[\u0027events\u0027] \u003d [self._format_event(ev) for ev in events_raw]","commit_id":"4b4db05f3c14406ee55a455760720efd862924be"},{"author":{"_account_id":360,"name":"Dan Prince","email":"dprince@redhat.com","username":"dan-prince"},"change_message_id":"b2f7c0bf8ef1d938ffddcab0c31f6ee1143bf5ef","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        \"\"\"Returns the list of actions recorded for a given instance.\"\"\""},{"line_number":86,"context_line":"        context \u003d req.environ[\"nova.context\"]"},{"line_number":87,"context_line":"        authorize_actions(context)"},{"line_number":88,"context_line":"        actions_raw \u003d db.actions_get(context, server_id)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        actions \u003d []"},{"line_number":91,"context_line":"        for action in actions_raw:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FCbQ%3D","line":88,"updated":"2013-02-10 02:44:56.000000000","message":"Since this is the first time we are exposing this externally to a normal user: Do we have a check in place to ensure instance actions from one project aren\u0027t accessible from another project (user account, etc)?","commit_id":"00fb0e1904c4dc42b0a115e69e9aea7617ed4805"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"5f023fc35e1fc42cb392656f8e2a46bb7a1522e4","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        \"\"\"Returns the list of actions recorded for a given instance.\"\"\""},{"line_number":86,"context_line":"        context \u003d req.environ[\"nova.context\"]"},{"line_number":87,"context_line":"        authorize_actions(context)"},{"line_number":88,"context_line":"        actions_raw \u003d db.actions_get(context, server_id)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        actions \u003d []"},{"line_number":91,"context_line":"        for action in actions_raw:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FBOA%3D","line":88,"in_reply_to":"AAAAM3%2F%2FBO4%3D","updated":"2013-02-11 14:50:43.000000000","message":"Actions are not intended to be admin only, but the additional details in events are.  I don\u0027t like the idea of embedding the check into the db layer.  No matter where it\u0027s done I\u0027ll need to pull the instance to get the project_id so I\u0027ll just grab it from the compute api here and pass it to authorize_actions.  Reworking tests now but should have another push soon.","commit_id":"00fb0e1904c4dc42b0a115e69e9aea7617ed4805"},{"author":{"_account_id":360,"name":"Dan Prince","email":"dprince@redhat.com","username":"dan-prince"},"change_message_id":"19346721dc6e6adf0852aa2e1909a8e067f094b5","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        \"\"\"Returns the list of actions recorded for a given instance.\"\"\""},{"line_number":86,"context_line":"        context \u003d req.environ[\"nova.context\"]"},{"line_number":87,"context_line":"        authorize_actions(context)"},{"line_number":88,"context_line":"        actions_raw \u003d db.actions_get(context, server_id)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        actions \u003d []"},{"line_number":91,"context_line":"        for action in actions_raw:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FBO4%3D","line":88,"in_reply_to":"AAAAM3%2F%2FBQE%3D","updated":"2013-02-11 14:42:51.000000000","message":"Some of these checks live in the DB API too... not saying that is the best place for them always but you might check there as well. It looked to me that instance actions might have been intended for admin users only.","commit_id":"00fb0e1904c4dc42b0a115e69e9aea7617ed4805"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"81bff0c70446f6fd7deede19c709ad50d0114efa","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        \"\"\"Returns the list of actions recorded for a given instance.\"\"\""},{"line_number":86,"context_line":"        context \u003d req.environ[\"nova.context\"]"},{"line_number":87,"context_line":"        authorize_actions(context)"},{"line_number":88,"context_line":"        actions_raw \u003d db.actions_get(context, server_id)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        actions \u003d []"},{"line_number":91,"context_line":"        for action in actions_raw:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FBQE%3D","line":88,"in_reply_to":"AAAAM3%2F%2FCbQ%3D","updated":"2013-02-11 14:23:59.000000000","message":"Apparently not.  I misunderstood how authorization works and didn\u0027t realize that auth typically happens in two parts between the wsgi api and compute api.","commit_id":"00fb0e1904c4dc42b0a115e69e9aea7617ed4805"},{"author":{"_account_id":360,"name":"Dan Prince","email":"dprince@redhat.com","username":"dan-prince"},"change_message_id":"b2f7c0bf8ef1d938ffddcab0c31f6ee1143bf5ef","unresolved":false,"context_lines":[{"line_number":97,"context_line":"        \"\"\"Return data about the given instance action.\"\"\""},{"line_number":98,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":99,"context_line":"        authorize_actions(context)"},{"line_number":100,"context_line":"        action \u003d db.action_get_by_request_id(context, server_id, id)"},{"line_number":101,"context_line":"        if action is None:"},{"line_number":102,"context_line":"            raise exc.HTTPNotFound()"},{"line_number":103,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAM3%2F%2FCbM%3D","line":100,"updated":"2013-02-10 02:44:56.000000000","message":"Ditto here: (are we checking to ensure the user can access this server\u0027s project).","commit_id":"00fb0e1904c4dc42b0a115e69e9aea7617ed4805"}],"nova/tests/api/openstack/compute/contrib/test_instance_actions.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"85c7bb4893a15ff415bcaf0cf34e34601c0f95ad","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2012 OpenStack LLC."},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2FG4I%3D","line":1,"updated":"2013-02-06 23:02:45.000000000","message":"attonit: copyright date","commit_id":"5a4ba4ee0b78cde56eb4d3c430ace292f0ab48e4"}]}
