)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"d5361a9d0ca1c1991fbf2ec08045091d5b411675","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Divya \u003cdikonoor@in.ibm.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-04-23 09:40:10 +0200"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"view hypervisor details rest api should be allowed for non-admins"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The current call to show hypervisor is broken and expects the"},{"line_number":10,"context_line":"user to have admin privileges always.It does not allow non-"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"bab921fb_07cf6bb1","line":7,"updated":"2015-04-23 08:11:07.000000000","message":"The show of hypervisor. There is method called detail, say detail at here is a little confuse I guess.","commit_id":"f3a3223df00293ae51c7ef1cc7e44100572412b1"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"d5361a9d0ca1c1991fbf2ec08045091d5b411675","unresolved":false,"context_lines":[{"line_number":7,"context_line":"view hypervisor details rest api should be allowed for non-admins"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The current call to show hypervisor is broken and expects the"},{"line_number":10,"context_line":"user to have admin privileges always.It does not allow non-"},{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"bab921fb_87bb7b0e","line":10,"updated":"2015-04-23 08:11:07.000000000","message":"\"always.It\", missing a blank space","commit_id":"f3a3223df00293ae51c7ef1cc7e44100572412b1"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"d5361a9d0ca1c1991fbf2ec08045091d5b411675","unresolved":false,"context_lines":[{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"},{"line_number":14,"context_line":"is caused due to regression and was working earlier.So the"},{"line_number":15,"context_line":"changes proposed here is merely retaining the older behavior."},{"line_number":16,"context_line":"To ensure that this works as before, the context passed to the"},{"line_number":17,"context_line":"db api layer is elevated so that it passes the requires_admin_"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"bab921fb_e74b572a","line":14,"updated":"2015-04-23 08:11:07.000000000","message":"\"earlier.So\", missing a blank space","commit_id":"f3a3223df00293ae51c7ef1cc7e44100572412b1"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ab76cce676166730a9f72de146e4ec4b282147f1","unresolved":false,"context_lines":[{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"},{"line_number":14,"context_line":"is caused due to regression and was working earlier.So the"},{"line_number":15,"context_line":"changes proposed here is merely retaining the older behavior."},{"line_number":16,"context_line":"To ensure that this works as before, the context passed to the"},{"line_number":17,"context_line":"db api layer is elevated so that it passes the requires_admin_"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"bab921fb_49b56dcb","line":14,"updated":"2015-04-23 14:02:40.000000000","message":"Point out that the regression was commit 091b9dab41bfa2a1b405c188adbb598abd18785d so we have the details here.\n\nAlso point out somewhere that this goes away in Liberty with change I06c90564e32a89761b752782d3fb74da9cc4d343.","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"629ee97391b9de911dd97b6f2ead649e947e7e38","unresolved":false,"context_lines":[{"line_number":7,"context_line":"view hypervisor details rest api should be allowed for non-admins"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The current call to show hypervisor is broken and expects the"},{"line_number":10,"context_line":"user to have admin privileges always.It does not allow non-"},{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"bab921fb_2bf43184","line":10,"updated":"2015-04-24 12:37:00.000000000","message":"and missing space. \u0027...always.It does not..\u0027 should be \u0027...always. It does not..\u0027","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"629ee97391b9de911dd97b6f2ead649e947e7e38","unresolved":false,"context_lines":[{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"},{"line_number":14,"context_line":"is caused due to regression and was working earlier.So the"},{"line_number":15,"context_line":"changes proposed here is merely retaining the older behavior."},{"line_number":16,"context_line":"To ensure that this works as before, the context passed to the"},{"line_number":17,"context_line":"db api layer is elevated so that it passes the requires_admin_"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"bab921fb_ab360150","line":14,"updated":"2015-04-24 12:37:00.000000000","message":"ditto","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"597fbb903e4dfd697e8049e69ab429c1de0b51ec","unresolved":false,"context_lines":[{"line_number":7,"context_line":"view hypervisor details rest api should be allowed for non-admins"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The current call to show hypervisor is broken and expects the"},{"line_number":10,"context_line":"user to have admin privileges always.It does not allow non-"},{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"bab921fb_70ec02f3","line":10,"updated":"2015-04-26 07:22:27.000000000","message":"Emm...there miss a space at \"always.It does not allow\"\n\nIf you have to update another patch, it\u0027s better to fix it.","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"597fbb903e4dfd697e8049e69ab429c1de0b51ec","unresolved":false,"context_lines":[{"line_number":11,"context_line":"admin users to view hypervisor details. This should be"},{"line_number":12,"context_line":"controlled based on the rule defined in the policy.json rather"},{"line_number":13,"context_line":"than have the permissions mandated programmatically. This bug"},{"line_number":14,"context_line":"is caused due to regression and was working earlier.So the"},{"line_number":15,"context_line":"changes proposed here is merely retaining the older behavior."},{"line_number":16,"context_line":"To ensure that this works as before, the context passed to the"},{"line_number":17,"context_line":"db api layer is elevated so that it passes the requires_admin_"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"bab921fb_50bc5edb","line":14,"updated":"2015-04-26 07:22:27.000000000","message":"ditto at \"working earlier.So the\"","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"}],"nova/api/openstack/compute/contrib/hypervisors.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"d5361a9d0ca1c1991fbf2ec08045091d5b411675","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":115,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":116,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":117,"context_line":"        service \u003d self.host_api.service_get_by_compute_host(ctxt.get_admin_context(), hyp.host)"},{"line_number":118,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":1,"id":"bab921fb_27f38f0c","line":117,"updated":"2015-04-23 08:11:07.000000000","message":"How about use context.elevated() at here directly?","commit_id":"f3a3223df00293ae51c7ef1cc7e44100572412b1"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"1e0b8b4fb403459a3492ccf0a99d13f372e4e378","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":115,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":116,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":117,"context_line":"        service \u003d self.host_api.service_get_by_compute_host(ctxt.get_admin_context(), hyp.host)"},{"line_number":118,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":1,"id":"bab921fb_47d56341","line":117,"updated":"2015-04-23 08:09:38.000000000","message":"why not just using context.elevated\nctxt.get_admin_context() is user_id and project_id is None","commit_id":"f3a3223df00293ae51c7ef1cc7e44100572412b1"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"10e459d4a45f3907a78f242d9aeacee1e329367e","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":109,"context_line":"        authorize(context)"},{"line_number":110,"context_line":"        try:"},{"line_number":111,"context_line":"            hyp \u003d self.host_api.compute_node_get(context, id)"},{"line_number":112,"context_line":"            req.cache_db_compute_node(hyp)"},{"line_number":113,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_9b0068ac","line":111,"updated":"2015-04-23 14:20:23.000000000","message":"This is OK because the DB API doesn\u0027t require admin context:\n\nhttps://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L544","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ab76cce676166730a9f72de146e4ec4b282147f1","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":115,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":116,"context_line":"        service \u003d self.host_api.service_get_by_compute_host(context.elevated(), hyp.host)"},{"line_number":117,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_a9888923","line":116,"updated":"2015-04-23 14:02:40.000000000","message":"Why is it just on show?  Shouldn\u0027t this be the case on all calls to host_api.service_get_by_compute_host?\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/etc/nova/policy.json?id\u003d2015.1.0rc2#n92\n\nThere should also be a comment (TODO) above this that says we\u0027re going to remove it with blueprint nova-api-policy-final-part.","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a87b896ec89857991a9393ce98601236a0ef4c1a","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":115,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":116,"context_line":"        service \u003d self.host_api.service_get_by_compute_host(context.elevated(), hyp.host)"},{"line_number":117,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_fb4be429","line":116,"in_reply_to":"bab921fb_a9888923","updated":"2015-04-23 14:15:44.000000000","message":"Alex pointed out that for index we call host_api.compute_node_get_all which still requires admin context in the DB API:\n\nhttps://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L596\n\nSo that\u0027s not a regression, it\u0027s just how it\u0027s worked in v2 API forever.","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"10e459d4a45f3907a78f242d9aeacee1e329367e","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        except NotImplementedError:"},{"line_number":134,"context_line":"            msg \u003d _(\"Virt driver does not implement uptime function.\")"},{"line_number":135,"context_line":"            raise webob.exc.HTTPNotImplemented(explanation\u003dmsg)"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        service \u003d self.host_api.service_get_by_compute_host(context, host)"},{"line_number":138,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, False,"},{"line_number":139,"context_line":"                                                     uptime\u003duptime))"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_7bba34e3","line":136,"updated":"2015-04-23 14:20:23.000000000","message":"Seems like this would also be OK, host_api.compute_node_get doesn\u0027t require admin and neither does host_api.get_host_uptime from what I can tell.","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"77f48402526a28e4b204a9a05f03a78120dcac15","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        except NotImplementedError:"},{"line_number":134,"context_line":"            msg \u003d _(\"Virt driver does not implement uptime function.\")"},{"line_number":135,"context_line":"            raise webob.exc.HTTPNotImplemented(explanation\u003dmsg)"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        service \u003d self.host_api.service_get_by_compute_host(context, host)"},{"line_number":138,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, False,"},{"line_number":139,"context_line":"                                                     uptime\u003duptime))"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_fb264415","line":136,"in_reply_to":"bab921fb_7bba34e3","updated":"2015-04-23 14:22:59.000000000","message":"Nevermind, host_api.get_host_uptime above calls host_api._assert_host_exists which calls service_get_by_compute_host so we can\u0027t change that.\n\nSo yeah, show is the only operation that\u0027s officially regressed here.","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"10e459d4a45f3907a78f242d9aeacee1e329367e","unresolved":false,"context_lines":[{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    def search(self, req, id):"},{"line_number":142,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":143,"context_line":"        authorize(context)"},{"line_number":144,"context_line":"        hypervisors \u003d self.host_api.compute_node_search_by_hypervisor("},{"line_number":145,"context_line":"                context, id)"},{"line_number":146,"context_line":"        if hypervisors:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_9b9ce86a","line":143,"updated":"2015-04-23 14:20:23.000000000","message":"This requires admin context in the DB API so we can\u0027t change anything here:\n\nhttps://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L601","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"10e459d4a45f3907a78f242d9aeacee1e329367e","unresolved":false,"context_lines":[{"line_number":156,"context_line":""},{"line_number":157,"context_line":"    def servers(self, req, id):"},{"line_number":158,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":159,"context_line":"        authorize(context)"},{"line_number":160,"context_line":"        compute_nodes \u003d self.host_api.compute_node_search_by_hypervisor("},{"line_number":161,"context_line":"                context, id)"},{"line_number":162,"context_line":"        if not compute_nodes:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab921fb_7b88f422","line":159,"updated":"2015-04-23 14:20:23.000000000","message":"ditto","commit_id":"4862af519890445651ce430c71425fbf706b4b57"},{"author":{"_account_id":13637,"name":"Divya K Konoor","email":"dikonoor@in.ibm.com","username":"dikonoor"},"change_message_id":"b869b71332674d58f35396fda661453b5b3799e6","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":115,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":116,"context_line":"        service \u003d self.host_api.service_get_by_compute_host("},{"line_number":117,"context_line":"            context.elevated(), hyp.host)"},{"line_number":118,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"bab921fb_53c23a35","line":116,"updated":"2015-04-25 13:01:47.000000000","message":"Alex_xu , removed the backslash :)","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"09088533f11dceaec567213b06fa2d13d68d5232","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":115,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":116,"context_line":"        service \u003d self.host_api.service_get_by_compute_host("},{"line_number":117,"context_line":"            context.elevated(), hyp.host)"},{"line_number":118,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9abe1de1_c0af347c","line":117,"updated":"2015-04-27 09:43:21.000000000","message":"I think it\u0027s not the right direction. I would rather prefer to remove the decorators on the DB API method so that we would still use the RBAC controls on the API and that\u0027s it\n\nThat change is targeted for the master branch, maybe that approach is valid for backporting to Kilo but not here IMHO","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ade1fd418a8246940cce834a515cc2d585f58763","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":115,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":116,"context_line":"        service \u003d self.host_api.service_get_by_compute_host("},{"line_number":117,"context_line":"            context.elevated(), hyp.host)"},{"line_number":118,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7ad32947_d60944df","line":117,"in_reply_to":"9abe1de1_6be4c90c","updated":"2015-04-27 13:39:24.000000000","message":"Sylvain, we can\u0027t backport https://review.openstack.org/#/c/160089/ to stable/kilo since that\u0027s tied to a blueprint.  That\u0027s the long-term fix, we need a short-term workaround fix here to backport to stable/kilo.  That\u0027s why I was saying last week that https://review.openstack.org/#/c/160089/ should be rebased on top of this change.","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"82cb81d96cad38ea12aa0ead3429ccac700f1327","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":115,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":116,"context_line":"        service \u003d self.host_api.service_get_by_compute_host("},{"line_number":117,"context_line":"            context.elevated(), hyp.host)"},{"line_number":118,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def uptime(self, req, id):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9abe1de1_6be4c90c","line":117,"in_reply_to":"9abe1de1_c0af347c","updated":"2015-04-27 10:03:11.000000000","message":"As I said in https://review.openstack.org/#/c/160089/10 I checked the default policy file and all the extensions are admin-only.\n\nSo, the whole patch is just unnecessary, we can just backport a new version of https://review.openstack.org/#/c/160089/10 to Kilo and that\u0027s it.","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"}],"nova/api/openstack/compute/plugins/v3/hypervisors.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"a773477e3b592804ad49b6481f7a640555441449","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":111,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":112,"context_line":"        service \u003d self.host_api.\\"},{"line_number":113,"context_line":"            service_get_by_compute_host(context.elevated(), hyp.host)"},{"line_number":114,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @extensions.expected_errors((404, 501))"}],"source_content_type":"text/x-python","patch_set":3,"id":"bab921fb_b09aec61","line":113,"updated":"2015-04-24 12:35:38.000000000","message":"we didn\u0027t suggestion to use \u0027\\\u0027 to change line.\n\nwe can change line after \u0027(\u0027","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":13637,"name":"Divya K Konoor","email":"dikonoor@in.ibm.com","username":"dikonoor"},"change_message_id":"b869b71332674d58f35396fda661453b5b3799e6","unresolved":false,"context_lines":[{"line_number":109,"context_line":"        except (ValueError, exception.ComputeHostNotFound):"},{"line_number":110,"context_line":"            msg \u003d _(\"Hypervisor with ID \u0027%s\u0027 could not be found.\") % id"},{"line_number":111,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003dmsg)"},{"line_number":112,"context_line":"        service \u003d self.host_api.service_get_by_compute_host("},{"line_number":113,"context_line":"            context.elevated(), hyp.host)"},{"line_number":114,"context_line":"        return dict(hypervisor\u003dself._view_hypervisor(hyp, service, True))"},{"line_number":115,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"bab921fb_f3bcaebc","line":112,"updated":"2015-04-25 13:01:47.000000000","message":"Alex_xu , removed the backslash :)","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"}],"nova/tests/unit/api/openstack/compute/contrib/test_hypervisors.py":[{"author":{"_account_id":12814,"name":"Bartosz Fic","email":"bartosz.fic@intel.com","username":"bartosz-fic"},"change_message_id":"2a4d73dc9b635777104ecbf6dd69b8d562f77b29","unresolved":false,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        self.assertEqual(result, dict(hypervisor\u003dself.DETAIL_HYPERS_DICTS[0]))"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def test_show_withid_non_admin(self):"},{"line_number":275,"context_line":"\trule_name1 \u003d \"os_compute_api:os-hypervisors\""},{"line_number":276,"context_line":"\trule_name2 \u003d \"compute_extension:hypervisors\""},{"line_number":277,"context_line":"        non_adm \u003d \"is_admin:False\""}],"source_content_type":"text/x-python","patch_set":3,"id":"bab921fb_6b7909c8","line":274,"updated":"2015-04-24 12:40:12.000000000","message":"What are the differences between this methods :\n- test_show_withid_non_admin\n- test_show_non_admin\n\n?","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"a773477e3b592804ad49b6481f7a640555441449","unresolved":false,"context_lines":[{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def test_show_withid_non_admin(self):"},{"line_number":275,"context_line":"\trule_name1 \u003d \"os_compute_api:os-hypervisors\""},{"line_number":276,"context_line":"\trule_name2 \u003d \"compute_extension:hypervisors\""},{"line_number":277,"context_line":"        non_adm \u003d \"is_admin:False\""},{"line_number":278,"context_line":"        self.policy.set_rules({rule_name1: non_adm, rule_name2: non_adm})"},{"line_number":279,"context_line":"        req \u003d self._get_request(False)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bab921fb_d07d60e8","line":276,"updated":"2015-04-24 12:35:38.000000000","message":"We should use \u0027space\u0027 instead of \u0027tab\u0027.","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"a773477e3b592804ad49b6481f7a640555441449","unresolved":false,"context_lines":[{"line_number":275,"context_line":"\trule_name1 \u003d \"os_compute_api:os-hypervisors\""},{"line_number":276,"context_line":"\trule_name2 \u003d \"compute_extension:hypervisors\""},{"line_number":277,"context_line":"        non_adm \u003d \"is_admin:False\""},{"line_number":278,"context_line":"        self.policy.set_rules({rule_name1: non_adm, rule_name2: non_adm})"},{"line_number":279,"context_line":"        req \u003d self._get_request(False)"},{"line_number":280,"context_line":"        result \u003d self.controller.show(req, self.TEST_HYPERS_OBJ[0].id)"},{"line_number":281,"context_line":"        self.assertEqual(result, dict(hypervisor\u003dself.DETAIL_HYPERS_DICTS[0]))"}],"source_content_type":"text/x-python","patch_set":3,"id":"bab921fb_6b7ea91a","line":278,"updated":"2015-04-24 12:35:38.000000000","message":"this looks like we mix two different test in one test.\n\nwe can move the rule_name to the class attribute. then we write like this:\n\nself.policy.set_rules({self.policy_rule_name: non_adm})","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"a773477e3b592804ad49b6481f7a640555441449","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        self.policy.set_rules({rule_name1: non_adm, rule_name2: non_adm})"},{"line_number":279,"context_line":"        req \u003d self._get_request(False)"},{"line_number":280,"context_line":"        result \u003d self.controller.show(req, self.TEST_HYPERS_OBJ[0].id)"},{"line_number":281,"context_line":"        self.assertEqual(result, dict(hypervisor\u003dself.DETAIL_HYPERS_DICTS[0]))"},{"line_number":282,"context_line":""},{"line_number":283,"context_line":"    def test_show_non_admin(self):"},{"line_number":284,"context_line":"        req \u003d self._get_request(False)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bab921fb_b0130c66","line":281,"updated":"2015-04-24 12:35:38.000000000","message":"This can ensure we pass a elevated context to the service_get_by_compute_host. We can mock host_api.service_get_by_compute_host. Then assert it called as we expected arguments.\n\nThere are some case how to assert the function called as expected https://github.com/openstack/nova/blob/master/nova/tests/unit/compute/test_compute_api.py#L522 you can reference","commit_id":"fa181e5c17c9b6bc80efc285e5c071cd0d59716f"},{"author":{"_account_id":13637,"name":"Divya K Konoor","email":"dikonoor@in.ibm.com","username":"dikonoor"},"change_message_id":"b869b71332674d58f35396fda661453b5b3799e6","unresolved":false,"context_lines":[{"line_number":195,"context_line":"    def setUp(self):"},{"line_number":196,"context_line":"        super(HypervisorsTestV21, self).setUp()"},{"line_number":197,"context_line":"        self._set_up_controller()"},{"line_number":198,"context_line":"        self.rule_hyp_show \u003d \"os_compute_api:os-hypervisors\""},{"line_number":199,"context_line":"        self.stubs.Set(self.controller.host_api, \u0027compute_node_get_all\u0027,"},{"line_number":200,"context_line":"                       fake_compute_node_get_all)"},{"line_number":201,"context_line":"        self.stubs.Set(self.controller.host_api, \u0027service_get_by_compute_host\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"bab921fb_b3ad169d","line":198,"updated":"2015-04-25 13:01:47.000000000","message":"This is the rule for show hypervisors for v21","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"bf4ea38ad0176971b71d423b8634018aa7e9bb5e","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        ctxt \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":279,"context_line":"        elevated_context \u003d ctxt.elevated()"},{"line_number":280,"context_line":"        with contextlib.nested("},{"line_number":281,"context_line":"            mock.patch.object(ctxt, \u0027elevated\u0027,"},{"line_number":282,"context_line":"                              return_value\u003delevated_context),"},{"line_number":283,"context_line":"            mock.patch.object(self.controller.host_api,"},{"line_number":284,"context_line":"                              \u0027service_get_by_compute_host\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9abe1de1_3d1df766","line":281,"updated":"2015-04-27 09:14:46.000000000","message":"Nit: You will find this much easer to write if you use the attribute form of this code. But not going to block on that.","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":13637,"name":"Divya K Konoor","email":"dikonoor@in.ibm.com","username":"dikonoor"},"change_message_id":"b869b71332674d58f35396fda661453b5b3799e6","unresolved":false,"context_lines":[{"line_number":286,"context_line":"            elevated_mock,"},{"line_number":287,"context_line":"            mock_service"},{"line_number":288,"context_line":"        ):"},{"line_number":289,"context_line":"            self.controller.show(req, self.TEST_HYPERS_OBJ[0].id)"},{"line_number":290,"context_line":"            mock_service.assert_called_once_with(elevated_context,"},{"line_number":291,"context_line":"                                                 self.TEST_HYPERS_OBJ[0].host)"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"bab921fb_33fea6ae","line":289,"updated":"2015-04-25 13:01:47.000000000","message":"Unfortunately , there\u0027s no assertion that says assertNotRaises PolicyNotAuthorized and if the test case runs , it means that PolicyNotAuthorized was not raised when the user is a non-admin.","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"bf4ea38ad0176971b71d423b8634018aa7e9bb5e","unresolved":false,"context_lines":[{"line_number":286,"context_line":"            elevated_mock,"},{"line_number":287,"context_line":"            mock_service"},{"line_number":288,"context_line":"        ):"},{"line_number":289,"context_line":"            self.controller.show(req, self.TEST_HYPERS_OBJ[0].id)"},{"line_number":290,"context_line":"            mock_service.assert_called_once_with(elevated_context,"},{"line_number":291,"context_line":"                                                 self.TEST_HYPERS_OBJ[0].host)"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9abe1de1_7d680fbb","line":289,"in_reply_to":"bab921fb_33fea6ae","updated":"2015-04-27 09:14:46.000000000","message":"the test would fail if an exception was raised, thats more than enough here.","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"},{"author":{"_account_id":13637,"name":"Divya K Konoor","email":"dikonoor@in.ibm.com","username":"dikonoor"},"change_message_id":"b869b71332674d58f35396fda661453b5b3799e6","unresolved":false,"context_lines":[{"line_number":456,"context_line":""},{"line_number":457,"context_line":"    def setUp(self):"},{"line_number":458,"context_line":"        super(HypervisorsTestV2, self).setUp()"},{"line_number":459,"context_line":"        self.rule_hyp_show \u003d \"compute_extension:hypervisors\""},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    def _set_up_controller(self):"},{"line_number":462,"context_line":"        self.context \u003d context.get_admin_context()"}],"source_content_type":"text/x-python","patch_set":4,"id":"bab921fb_73941e42","line":459,"updated":"2015-04-25 13:01:47.000000000","message":"This is the rule for show hypervisors for v2","commit_id":"6be11856c6ac1cbd611cea894a0e26165ee5c5a5"}]}
