)]}'
{"nova/network/neutronv2/api.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"02bd54611e0ba41c52f47a679d33c8a79c9ca7a7","unresolved":false,"context_lines":[{"line_number":803,"context_line":"                        port \u003d neutron.show_port(request.port_id).get(\u0027port\u0027)"},{"line_number":804,"context_line":"                    except neutron_client_exc.NeutronClientException as e:"},{"line_number":805,"context_line":"                        if e.status_code \u003d\u003d 404:"},{"line_number":806,"context_line":"                            port \u003d None"},{"line_number":807,"context_line":"                        else:"},{"line_number":808,"context_line":"                            with excutils.save_and_reraise_exception():"},{"line_number":809,"context_line":"                                LOG.exception(_LE(\"Failed to access port %s\"),"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_748f2276","side":"PARENT","line":806,"updated":"2014-11-19 13:12:14.000000000","message":"this case is not treated.","commit_id":"9e470eef829880790dc53b90b2c0c596127d7a8a"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"cf0f000c2754db602396355f272c6e5ef4f11ef7","unresolved":false,"context_lines":[{"line_number":803,"context_line":"                        port \u003d neutron.show_port(request.port_id).get(\u0027port\u0027)"},{"line_number":804,"context_line":"                    except neutron_client_exc.NeutronClientException as e:"},{"line_number":805,"context_line":"                        if e.status_code \u003d\u003d 404:"},{"line_number":806,"context_line":"                            port \u003d None"},{"line_number":807,"context_line":"                        else:"},{"line_number":808,"context_line":"                            with excutils.save_and_reraise_exception():"},{"line_number":809,"context_line":"                                LOG.exception(_LE(\"Failed to access port %s\"),"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_205d50ea","side":"PARENT","line":806,"in_reply_to":"5a890539_748f2276","updated":"2014-11-19 14:32:35.000000000","message":"My assumption is in this case PortNotFoundClient will be thrown, and it will be caught by _show_port(). Am I correct?","commit_id":"9e470eef829880790dc53b90b2c0c596127d7a8a"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"02bd54611e0ba41c52f47a679d33c8a79c9ca7a7","unresolved":false,"context_lines":[{"line_number":581,"context_line":""},{"line_number":582,"context_line":"    def _show_port(self, context, port_id, neutron_client\u003dNone, fields\u003dNone):"},{"line_number":583,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":584,"context_line":"        try:"},{"line_number":585,"context_line":"            if not neutron_client:"},{"line_number":586,"context_line":"                neutron_client \u003d neutronv2.get_client(context)"},{"line_number":587,"context_line":"            if not fields:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_14aa5ed4","line":584,"updated":"2014-11-19 13:12:14.000000000","message":"i think that the try should be on line 585 and not here","commit_id":"8ef33b6da311971fa59c45f26d19101c519a2f46"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"cf0f000c2754db602396355f272c6e5ef4f11ef7","unresolved":false,"context_lines":[{"line_number":581,"context_line":""},{"line_number":582,"context_line":"    def _show_port(self, context, port_id, neutron_client\u003dNone, fields\u003dNone):"},{"line_number":583,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":584,"context_line":"        try:"},{"line_number":585,"context_line":"            if not neutron_client:"},{"line_number":586,"context_line":"                neutron_client \u003d neutronv2.get_client(context)"},{"line_number":587,"context_line":"            if not fields:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_603bd838","line":584,"in_reply_to":"5a890539_14aa5ed4","updated":"2014-11-19 14:32:35.000000000","message":"Gary, do you mean excluding get_client() from \u0027try\u0027 block? Because Unauthorized exception may be thrown by get_client(), we need to  make it in the \u0027try\u0027 block. That is consistent with the existing code.","commit_id":"8ef33b6da311971fa59c45f26d19101c519a2f46"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"02bd54611e0ba41c52f47a679d33c8a79c9ca7a7","unresolved":false,"context_lines":[{"line_number":583,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":584,"context_line":"        try:"},{"line_number":585,"context_line":"            if not neutron_client:"},{"line_number":586,"context_line":"                neutron_client \u003d neutronv2.get_client(context)"},{"line_number":587,"context_line":"            if not fields:"},{"line_number":588,"context_line":"                return neutron_client.show_port(port_id)"},{"line_number":589,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_34675aec","line":586,"updated":"2014-11-19 13:12:14.000000000","message":"nice!","commit_id":"8ef33b6da311971fa59c45f26d19101c519a2f46"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"fd2f6f5bed39ae6f21c24832799e0f4c1da5e3c7","unresolved":false,"context_lines":[{"line_number":803,"context_line":"                        port \u003d neutron.show_port(request.port_id).get(\u0027port\u0027)"},{"line_number":804,"context_line":"                    except neutron_client_exc.NeutronClientException as e:"},{"line_number":805,"context_line":"                        if e.status_code \u003d\u003d 404:"},{"line_number":806,"context_line":"                            port \u003d None"},{"line_number":807,"context_line":"                        else:"},{"line_number":808,"context_line":"                            with excutils.save_and_reraise_exception():"},{"line_number":809,"context_line":"                                LOG.exception(_LE(\"Failed to access port %s\"),"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_3a520613","side":"PARENT","line":806,"updated":"2014-11-26 14:50:24.000000000","message":"here we are breaking the current support - instead of continuing we are going to raise and exception here","commit_id":"a91f1b12c9bb2c25e30a4a101ab87766c15c4ab2"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"335c6241c2947cb9a6e70c801a9876d359b1f8e2","unresolved":false,"context_lines":[{"line_number":803,"context_line":"                        port \u003d neutron.show_port(request.port_id).get(\u0027port\u0027)"},{"line_number":804,"context_line":"                    except neutron_client_exc.NeutronClientException as e:"},{"line_number":805,"context_line":"                        if e.status_code \u003d\u003d 404:"},{"line_number":806,"context_line":"                            port \u003d None"},{"line_number":807,"context_line":"                        else:"},{"line_number":808,"context_line":"                            with excutils.save_and_reraise_exception():"},{"line_number":809,"context_line":"                                LOG.exception(_LE(\"Failed to access port %s\"),"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_9b56f75c","side":"PARENT","line":806,"in_reply_to":"5a890539_3a520613","updated":"2014-12-03 10:36:36.000000000","message":"Gary, Sorry, I did not get your point... What is broken? The code will raise PortNotFound, if 404 error is returned by Neutron; and will raise Neutron client exception, if other error is returned by Neutron. I think my new code also does the same thing.","commit_id":"a91f1b12c9bb2c25e30a4a101ab87766c15c4ab2"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"fd2f6f5bed39ae6f21c24832799e0f4c1da5e3c7","unresolved":false,"context_lines":[{"line_number":583,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":584,"context_line":"        try:"},{"line_number":585,"context_line":"            if not neutron_client:"},{"line_number":586,"context_line":"                neutron_client \u003d neutronv2.get_client(context)"},{"line_number":587,"context_line":"            if not fields:"},{"line_number":588,"context_line":"                return neutron_client.show_port(port_id)"},{"line_number":589,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_df03b40d","line":586,"updated":"2014-11-26 14:50:24.000000000","message":"why not:\nreturn return neutron_client.show_port(port_id, fields\u003dfields)\nThis should also work if fields is None unless I am mistaken.","commit_id":"1edcf19f7c5517dbcc7df7b20aeb71bcb178a2b5"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"335c6241c2947cb9a6e70c801a9876d359b1f8e2","unresolved":false,"context_lines":[{"line_number":583,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":584,"context_line":"        try:"},{"line_number":585,"context_line":"            if not neutron_client:"},{"line_number":586,"context_line":"                neutron_client \u003d neutronv2.get_client(context)"},{"line_number":587,"context_line":"            if not fields:"},{"line_number":588,"context_line":"                return neutron_client.show_port(port_id)"},{"line_number":589,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_9b7ef719","line":586,"in_reply_to":"5a890539_df03b40d","updated":"2014-12-03 10:36:36.000000000","message":"Gary, inn fact, I am working around unit test failures... After adding \u0027fields\u003dfields\u0027, lots of unit test cases which check input parameter will fail, because they assume port_id is the only parameter. I know the code style here is not pretty.","commit_id":"1edcf19f7c5517dbcc7df7b20aeb71bcb178a2b5"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"fd2f6f5bed39ae6f21c24832799e0f4c1da5e3c7","unresolved":false,"context_lines":[{"line_number":592,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"},{"line_number":593,"context_line":"        except neutron_client_exc.Unauthorized:"},{"line_number":594,"context_line":"            raise exception.Forbidden()"},{"line_number":595,"context_line":"        except neutron_client_exc.NeutronClientException:"},{"line_number":596,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":597,"context_line":"                LOG.exception(_LE(\"Failed to access port %s\"),"},{"line_number":598,"context_line":"                              port_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_5a07d217","line":595,"updated":"2014-11-26 14:50:24.000000000","message":"why not raise a Nova exception here?","commit_id":"1edcf19f7c5517dbcc7df7b20aeb71bcb178a2b5"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"335c6241c2947cb9a6e70c801a9876d359b1f8e2","unresolved":false,"context_lines":[{"line_number":592,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"},{"line_number":593,"context_line":"        except neutron_client_exc.Unauthorized:"},{"line_number":594,"context_line":"            raise exception.Forbidden()"},{"line_number":595,"context_line":"        except neutron_client_exc.NeutronClientException:"},{"line_number":596,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":597,"context_line":"                LOG.exception(_LE(\"Failed to access port %s\"),"},{"line_number":598,"context_line":"                              port_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_7be22bd6","line":595,"in_reply_to":"5a890539_5a07d217","updated":"2014-12-03 10:36:36.000000000","message":"The original code also raise this neutron client exception at line 808. I was not attempting to change it behavior.","commit_id":"1edcf19f7c5517dbcc7df7b20aeb71bcb178a2b5"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"5d5ea56c5012479a68f8026f698e78841f2c46b7","unresolved":false,"context_lines":[{"line_number":892,"context_line":"                        port \u003d neutron.show_port(request.port_id).get(\u0027port\u0027)"},{"line_number":893,"context_line":"                    except neutron_client_exc.NeutronClientException as e:"},{"line_number":894,"context_line":"                        if e.status_code \u003d\u003d 404:"},{"line_number":895,"context_line":"                            port \u003d None"},{"line_number":896,"context_line":"                        else:"},{"line_number":897,"context_line":"                            with excutils.save_and_reraise_exception():"},{"line_number":898,"context_line":"                                LOG.exception(_LE(\"Failed to access port %s\"),"}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_70070f1e","side":"PARENT","line":895,"updated":"2015-02-16 07:25:30.000000000","message":"why is this case not handled above?","commit_id":"e57412c05e2ee52d40d294a1636c9fc2b990b636"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"0846b1c2b57b08e3978320813601ff44d2497fa2","unresolved":false,"context_lines":[{"line_number":892,"context_line":"                        port \u003d neutron.show_port(request.port_id).get(\u0027port\u0027)"},{"line_number":893,"context_line":"                    except neutron_client_exc.NeutronClientException as e:"},{"line_number":894,"context_line":"                        if e.status_code \u003d\u003d 404:"},{"line_number":895,"context_line":"                            port \u003d None"},{"line_number":896,"context_line":"                        else:"},{"line_number":897,"context_line":"                            with excutils.save_and_reraise_exception():"},{"line_number":898,"context_line":"                                LOG.exception(_LE(\"Failed to access port %s\"),"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_33f16f95","side":"PARENT","line":895,"in_reply_to":"da86d52c_70070f1e","updated":"2015-03-10 07:47:05.000000000","message":"The assumption is that Neutron client will return PortNotFoundClient exception, so that it can be handled by line 681 in _show_port()","commit_id":"e57412c05e2ee52d40d294a1636c9fc2b990b636"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"5d5ea56c5012479a68f8026f698e78841f2c46b7","unresolved":false,"context_lines":[{"line_number":672,"context_line":"    def _show_port(self, context, port_id, neutron_client\u003dNone, fields\u003dNone):"},{"line_number":673,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":674,"context_line":"        try:"},{"line_number":675,"context_line":"            if not neutron_client:"},{"line_number":676,"context_line":"                neutron_client \u003d get_client(context)"},{"line_number":677,"context_line":"            if not fields:"},{"line_number":678,"context_line":"                return neutron_client.show_port(port_id)"}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_f034dffc","line":675,"updated":"2015-02-16 07:25:30.000000000","message":"lines 675-676 do not need to be in the try","commit_id":"65f551c23916a52a0d6a710fea1bc94de9f9fa57"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"0846b1c2b57b08e3978320813601ff44d2497fa2","unresolved":false,"context_lines":[{"line_number":672,"context_line":"    def _show_port(self, context, port_id, neutron_client\u003dNone, fields\u003dNone):"},{"line_number":673,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":674,"context_line":"        try:"},{"line_number":675,"context_line":"            if not neutron_client:"},{"line_number":676,"context_line":"                neutron_client \u003d get_client(context)"},{"line_number":677,"context_line":"            if not fields:"},{"line_number":678,"context_line":"                return neutron_client.show_port(port_id)"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_b381dffc","line":675,"in_reply_to":"da86d52c_f034dffc","updated":"2015-03-10 07:47:05.000000000","message":"Done","commit_id":"65f551c23916a52a0d6a710fea1bc94de9f9fa57"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"5d5ea56c5012479a68f8026f698e78841f2c46b7","unresolved":false,"context_lines":[{"line_number":685,"context_line":"        except neutron_client_exc.NeutronClientException:"},{"line_number":686,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":687,"context_line":"                LOG.exception(_LE(\"Failed to access port %s\"),"},{"line_number":688,"context_line":"                              port_id)"},{"line_number":689,"context_line":""},{"line_number":690,"context_line":"    def get_instance_nw_info(self, context, instance, networks\u003dNone,"},{"line_number":691,"context_line":"                             port_ids\u003dNone, use_slave\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_7020efb0","line":688,"updated":"2015-02-16 07:25:30.000000000","message":"why do we not raise a nova exception here?","commit_id":"65f551c23916a52a0d6a710fea1bc94de9f9fa57"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"0846b1c2b57b08e3978320813601ff44d2497fa2","unresolved":false,"context_lines":[{"line_number":685,"context_line":"        except neutron_client_exc.NeutronClientException:"},{"line_number":686,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":687,"context_line":"                LOG.exception(_LE(\"Failed to access port %s\"),"},{"line_number":688,"context_line":"                              port_id)"},{"line_number":689,"context_line":""},{"line_number":690,"context_line":"    def get_instance_nw_info(self, context, instance, networks\u003dNone,"},{"line_number":691,"context_line":"                             port_ids\u003dNone, use_slave\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_93669b4f","line":688,"in_reply_to":"da86d52c_7020efb0","updated":"2015-03-10 07:47:05.000000000","message":"The original code does not raise exception here, so I just keep its behavior consistent. It is fine to raise a Nova exception here.","commit_id":"65f551c23916a52a0d6a710fea1bc94de9f9fa57"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"2af6140a2d0c21fa6c14cdd65595481eb030ead4","unresolved":false,"context_lines":[{"line_number":701,"context_line":"            neutron_client \u003d get_client(context)"},{"line_number":702,"context_line":"        try:"},{"line_number":703,"context_line":"            if not fields:"},{"line_number":704,"context_line":"                return neutron_client.show_port(port_id)"},{"line_number":705,"context_line":"            else:"},{"line_number":706,"context_line":"                return neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":707,"context_line":"        except neutron_client_exc.PortNotFoundClient:"}],"source_content_type":"text/x-python","patch_set":9,"id":"da9b358b_be72077b","line":704,"updated":"2015-03-29 22:23:36.000000000","message":"Given everything calling this has to pull the \u0027port\u0027 key out of the response body, I\u0027m thinking if we\u0027re going to refactor this anyway, we should just return the port entry from the body in this method so the callers don\u0027t have to do that themselves.","commit_id":"5cd0736c4ea106b41f705bf6f54654154b1a89d5"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"2af6140a2d0c21fa6c14cdd65595481eb030ead4","unresolved":false,"context_lines":[{"line_number":709,"context_line":"        except neutron_client_exc.Unauthorized:"},{"line_number":710,"context_line":"            raise exception.Forbidden()"},{"line_number":711,"context_line":"        except neutron_client_exc.NeutronClientException as exc:"},{"line_number":712,"context_line":"            msg \u003d (_(\"Failed to access port %(port_id)s: %(reason)s\"),"},{"line_number":713,"context_line":"                   {\u0027port_id\u0027: port_id, \u0027reason\u0027: exc.message})"},{"line_number":714,"context_line":"            raise exception.NovaException(message\u003dmsg)"},{"line_number":715,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"da9b358b_1e6333b3","line":712,"updated":"2015-03-29 22:23:36.000000000","message":"This would be a new translatable message and we\u0027re past string freeze so we have to hold off on this change until Liberty.","commit_id":"5cd0736c4ea106b41f705bf6f54654154b1a89d5"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d0a3387f1e1d8c62ceaf177ce4131afe41f86358","unresolved":false,"context_lines":[{"line_number":709,"context_line":"        except neutron_client_exc.Unauthorized:"},{"line_number":710,"context_line":"            raise exception.Forbidden()"},{"line_number":711,"context_line":"        except neutron_client_exc.NeutronClientException as exc:"},{"line_number":712,"context_line":"            msg \u003d (_(\"Failed to access port %(port_id)s: %(reason)s\"),"},{"line_number":713,"context_line":"                   {\u0027port_id\u0027: port_id, \u0027reason\u0027: exc.message})"},{"line_number":714,"context_line":"            raise exception.NovaException(message\u003dmsg)"},{"line_number":715,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aaa499b_df4a4d83","line":712,"in_reply_to":"da9b358b_1e6333b3","updated":"2015-04-13 17:32:19.000000000","message":"This is no longer an issue given we\u0027re in Liberty development now.","commit_id":"5cd0736c4ea106b41f705bf6f54654154b1a89d5"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"780e79798ca6a985a9304a88537acd09553a77a5","unresolved":false,"context_lines":[{"line_number":819,"context_line":"            neutron_client \u003d get_client(context)"},{"line_number":820,"context_line":"        try:"},{"line_number":821,"context_line":"            if not fields:"},{"line_number":822,"context_line":"                return neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                return neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"        except neutron_client_exc.PortNotFoundClient:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7a016987_c4bb960d","line":822,"updated":"2015-05-14 19:09:23.000000000","message":"Given everything calling this has to pull the \u0027port\u0027 key out of the response body, I\u0027m thinking if we\u0027re going to refactor this anyway, we should just return the port entry from the body in this method so the callers don\u0027t have to do that themselves.","commit_id":"6534e4ab868bca1e1f26275b986fffcd163ac387"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"4e5b96f4b2d13e5ec3ed506f6fcebc11df86c283","unresolved":false,"context_lines":[{"line_number":819,"context_line":"            neutron_client \u003d get_client(context)"},{"line_number":820,"context_line":"        try:"},{"line_number":821,"context_line":"            if not fields:"},{"line_number":822,"context_line":"                return neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                return neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"        except neutron_client_exc.PortNotFoundClient:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7a016987_e74b26af","line":822,"in_reply_to":"7a016987_c4bb960d","updated":"2015-05-15 04:51:05.000000000","message":"Done","commit_id":"6534e4ab868bca1e1f26275b986fffcd163ac387"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"01be6a296c2cb1f7dbc0384860d573987d09e1cc","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"            if result:"},{"line_number":826,"context_line":"                return result.get(\u0027port\u0027)"},{"line_number":827,"context_line":"        except neutron_client_exc.PortNotFoundClient:"},{"line_number":828,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a016987_67df046a","line":825,"updated":"2015-05-17 20:01:43.000000000","message":"I don\u0027t think we would ever not have a result here, we\u0027d have an exception otherwise from the client.","commit_id":"e23196ad37974eeb70cf4cbaabfb5cb16fec0029"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"d547ee30a57f3c2844b3a7234683bc001d2a3c38","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"            if result:"},{"line_number":826,"context_line":"                return result.get(\u0027port\u0027)"},{"line_number":827,"context_line":"        except neutron_client_exc.PortNotFoundClient:"},{"line_number":828,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a016987_d263bc40","line":825,"in_reply_to":"7a016987_67df046a","updated":"2015-05-21 17:42:50.000000000","message":"Agree with you. I was just hoping to ensure it will never throw exception when return port attribute, when I wrote that line of code.","commit_id":"e23196ad37974eeb70cf4cbaabfb5cb16fec0029"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"d8ece1d8f2e4ebc1e363a8b9943b4ddf10c2fa97","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"            if result:"},{"line_number":826,"context_line":"                return result.get(\u0027port\u0027)"},{"line_number":827,"context_line":"        except neutron_client_exc.PortNotFoundClient:"},{"line_number":828,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a016987_a5c09f7d","line":825,"in_reply_to":"7a016987_afcd205f","updated":"2015-05-26 14:46:19.000000000","message":"Just hope to ensure it will never raise AttributeError here. Anyway, it\u0027s OK to remove it.","commit_id":"e23196ad37974eeb70cf4cbaabfb5cb16fec0029"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"69ef36f97eba4bf9107c168276fcf0d8f8715450","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"            if result:"},{"line_number":826,"context_line":"                return result.get(\u0027port\u0027)"},{"line_number":827,"context_line":"        except neutron_client_exc.PortNotFoundClient:"},{"line_number":828,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a016987_afcd205f","line":825,"in_reply_to":"7a016987_d263bc40","updated":"2015-05-26 14:12:09.000000000","message":"I\u0027m not sure I understand.  If we agree that show_port will either return something or raise an exception, then let\u0027s remove the check for \u0027if result\u0027.","commit_id":"e23196ad37974eeb70cf4cbaabfb5cb16fec0029"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"929db5cad3941eb23ad8cd9b9960fd2d4c03ae14","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"            return result.get(\u0027port\u0027)"},{"line_number":826,"context_line":"        except neutron_client_exc.PortNotFoundClient:"},{"line_number":827,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"},{"line_number":828,"context_line":"        except neutron_client_exc.Unauthorized:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_a292d555","line":825,"updated":"2015-06-05 13:42:17.000000000","message":"Ugh, I guess there are things in nova-api which are expecting a dict to come back with a port key:\n\nhttp://logs.openstack.org/20/135020/13/check/check-tempest-dsvm-neutron-full/1ac45d7/logs/screen-n-api.txt.gz?level\u003dTRACE#_2015-06-03_17_00_14_196\n\nSo the public show_port method needs to continue returning {\u0027port\u0027: {...}}.\n\nIf everything else in here is now using the private _show_port method, that could continue returning just the port dict and then show_port could throw that into a dict:\n\nreturn dict(port\u003dself._show_port(context, port_id))\n\nBut it\u0027s up to you, you could just go back to the way it was before too where all callers had to get the contents using the \u0027port\u0027 key from the response.","commit_id":"8fbe2ffd7b20b989f9fe5b8261962f52aac04df7"},{"author":{"_account_id":8574,"name":"Qin Zhao","username":"zhaoqin","inactive":true},"change_message_id":"9e8835545ae428b0b2e57e38c8163347b1b34b70","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":823,"context_line":"            else:"},{"line_number":824,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"},{"line_number":825,"context_line":"            return result.get(\u0027port\u0027)"},{"line_number":826,"context_line":"        except neutron_client_exc.PortNotFoundClient:"},{"line_number":827,"context_line":"            raise exception.PortNotFound(port_id\u003dport_id)"},{"line_number":828,"context_line":"        except neutron_client_exc.Unauthorized:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_dcdb711a","line":825,"in_reply_to":"3afb71cf_a292d555","updated":"2015-06-05 15:33:14.000000000","message":"Done.\n\nThanks for catching this error!","commit_id":"8fbe2ffd7b20b989f9fe5b8261962f52aac04df7"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dcd8c1d692c70aea1a979397688f29aa42cb94b3","unresolved":false,"context_lines":[{"line_number":817,"context_line":"        return get_client(context).list_ports(**search_opts)"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":"    def show_port(self, context, port_id):"},{"line_number":820,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":821,"context_line":"        return dict(port\u003dself._show_port(context, port_id))"},{"line_number":822,"context_line":""},{"line_number":823,"context_line":"    def _show_port(self, context, port_id, neutron_client\u003dNone, fields\u003dNone):"}],"source_content_type":"text/x-python","patch_set":14,"id":"3afb71cf_fcad0d32","line":820,"updated":"2015-06-05 15:42:22.000000000","message":"nit: it\u0027s probably worthwhile to add a docstring for the return value since it\u0027s going to be different from _show_port which might confuse people.","commit_id":"26a1345ca7739d204f2bcd6dc9a5a5312151f347"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dcd8c1d692c70aea1a979397688f29aa42cb94b3","unresolved":false,"context_lines":[{"line_number":821,"context_line":"        return dict(port\u003dself._show_port(context, port_id))"},{"line_number":822,"context_line":""},{"line_number":823,"context_line":"    def _show_port(self, context, port_id, neutron_client\u003dNone, fields\u003dNone):"},{"line_number":824,"context_line":"        \"\"\"Return the port for the client given the port id.\"\"\""},{"line_number":825,"context_line":"        if not neutron_client:"},{"line_number":826,"context_line":"            neutron_client \u003d get_client(context)"},{"line_number":827,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":14,"id":"3afb71cf_1c78e9c3","line":824,"updated":"2015-06-05 15:42:22.000000000","message":"nit: we should probably add param and return type docstrings here so things don\u0027t get confused, especially the return type being a port dict, not a port dict within a response body dict like show_port will have.","commit_id":"26a1345ca7739d204f2bcd6dc9a5a5312151f347"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dcd8c1d692c70aea1a979397688f29aa42cb94b3","unresolved":false,"context_lines":[{"line_number":825,"context_line":"        if not neutron_client:"},{"line_number":826,"context_line":"            neutron_client \u003d get_client(context)"},{"line_number":827,"context_line":"        try:"},{"line_number":828,"context_line":"            if not fields:"},{"line_number":829,"context_line":"                result \u003d neutron_client.show_port(port_id)"},{"line_number":830,"context_line":"            else:"},{"line_number":831,"context_line":"                result \u003d neutron_client.show_port(port_id, fields\u003dfields)"}],"source_content_type":"text/x-python","patch_set":14,"id":"3afb71cf_3725feaa","line":828,"updated":"2015-06-05 15:42:22.000000000","message":"nit: this is personal style preference, but I like to avoid negative logic, so I\u0027d just do this:\n\nif fields:\n    result \u003d neutron_client.show_port(port_id, fields\u003dfields)\nelse:\n    result \u003d neutron_client.show_port(port_id)","commit_id":"26a1345ca7739d204f2bcd6dc9a5a5312151f347"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dcd8c1d692c70aea1a979397688f29aa42cb94b3","unresolved":false,"context_lines":[{"line_number":836,"context_line":"            raise exception.Forbidden()"},{"line_number":837,"context_line":"        except neutron_client_exc.NeutronClientException as exc:"},{"line_number":838,"context_line":"            msg \u003d (_(\"Failed to access port %(port_id)s: %(reason)s\"),"},{"line_number":839,"context_line":"                   {\u0027port_id\u0027: port_id, \u0027reason\u0027: exc.message})"},{"line_number":840,"context_line":"            raise exception.NovaException(message\u003dmsg)"},{"line_number":841,"context_line":""},{"line_number":842,"context_line":"    def get_instance_nw_info(self, context, instance, networks\u003dNone,"}],"source_content_type":"text/x-python","patch_set":14,"id":"3afb71cf_5c3b01ec","line":839,"updated":"2015-06-05 15:42:22.000000000","message":"nit: just pass exc for \u0027reason\u0027 here, it will stringify out the message.  I\u0027d prefer not to be dependent on what NeutronClientException uses for attributes.","commit_id":"26a1345ca7739d204f2bcd6dc9a5a5312151f347"}]}
