)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":13438,"name":"Kobi Samoray","email":"kobi.samoray@broadcom.com","username":"ksamoray"},"change_message_id":"76df2763ce376a77ffe93ed722c406775d67707a","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Metadata service identified an instance by its IP address which is"},{"line_number":10,"context_line":"stored in X-Forwarded-For header, and the attached router instance"},{"line_number":11,"context_line":"which is stored in X-LB-Proxy-ID header."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"DocImpact"},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3a961159_558e10d2","line":11,"updated":"2015-01-15 14:57:26.000000000","message":"It\u0027s stored in X-Metadata-Provider","commit_id":"35639c28e8b24cac19f62aac3919307fab258d63"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"de8d0b48feafacfd677c115c931012108284af0c","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Metadata service identified an instance by its IP address which is"},{"line_number":10,"context_line":"stored in X-Forwarded-For header, and the attached router instance"},{"line_number":11,"context_line":"which is stored in X-LB-Proxy-ID header."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"DocImpact"},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3a961159_fbf36d06","line":11,"in_reply_to":"3a961159_558e10d2","updated":"2015-01-15 15:32:13.000000000","message":"Done","commit_id":"35639c28e8b24cac19f62aac3919307fab258d63"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"0f1dcbc0db2079181b298ffaaea2ac56bb9cff09","unresolved":false,"context_lines":[{"line_number":28,"context_line":"in a similar way to X-Instance-ID-Signature with X-Instance-ID is"},{"line_number":29,"context_line":"authenticated the metadata proxy requests."},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"DocImpact"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"Co-authored-by: Kobi Samoray \u003cksamoray@vmware.com\u003e"},{"line_number":34,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":15,"id":"9a41bdd9_1d43026e","line":31,"updated":"2015-07-17 08:56:29.000000000","message":"I think this has SecuirtyImpact","commit_id":"0cb1b16831b8731a37c3c86be61adddc95bd78e7"}],"nova/api/metadata/handler.py":[{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"584eeb9609f46acdbf66205e90416be819da84d8","unresolved":false,"context_lines":[{"line_number":267,"context_line":"        #  provider has to be unique."},{"line_number":268,"context_line":"        #"},{"line_number":269,"context_line":"        #  The networks which are connected to the metadata provider are"},{"line_number":270,"context_line":"        #  retrieved in the st call to neutron.list_subnets()"},{"line_number":271,"context_line":"        #  In the 2nd call we read the ports which belong to any of the"},{"line_number":272,"context_line":"        #  networks retrieved above, and have the X-Forwarded-For IP address."},{"line_number":273,"context_line":"        #  This combination has to be unique as explained above, and we can"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_6ea3b59e","line":270,"updated":"2015-01-28 18:14:17.000000000","message":"st \u003d first","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"455eabf319dab55639add7ebedaba7974b1c14cc","unresolved":false,"context_lines":[{"line_number":267,"context_line":"        #  provider has to be unique."},{"line_number":268,"context_line":"        #"},{"line_number":269,"context_line":"        #  The networks which are connected to the metadata provider are"},{"line_number":270,"context_line":"        #  retrieved in the st call to neutron.list_subnets()"},{"line_number":271,"context_line":"        #  In the 2nd call we read the ports which belong to any of the"},{"line_number":272,"context_line":"        #  networks retrieved above, and have the X-Forwarded-For IP address."},{"line_number":273,"context_line":"        #  This combination has to be unique as explained above, and we can"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_91e72940","line":270,"in_reply_to":"fa81d914_6ea3b59e","updated":"2015-01-28 19:20:00.000000000","message":"Done","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"584eeb9609f46acdbf66205e90416be819da84d8","unresolved":false,"context_lines":[{"line_number":314,"context_line":"                              {\u0027provider\u0027: provider_id,"},{"line_number":315,"context_line":"                               \u0027networks\u0027: md_networks,"},{"line_number":316,"context_line":"                               \u0027requester\u0027: instance_address,"},{"line_number":317,"context_line":"                               \u0027exception\u0027: e})"},{"line_number":318,"context_line":""},{"line_number":319,"context_line":"            msg \u003d _(\u0027An unknown error has occurred. \u0027"},{"line_number":320,"context_line":"                    \u0027Please try your request again.\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_4e3b513a","line":317,"updated":"2015-01-28 18:14:17.000000000","message":"You don\u0027t need the exception: e here as Log.exception() will log the exception for you (and you can remove the as e on line 303).","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"455eabf319dab55639add7ebedaba7974b1c14cc","unresolved":false,"context_lines":[{"line_number":314,"context_line":"                              {\u0027provider\u0027: provider_id,"},{"line_number":315,"context_line":"                               \u0027networks\u0027: md_networks,"},{"line_number":316,"context_line":"                               \u0027requester\u0027: instance_address,"},{"line_number":317,"context_line":"                               \u0027exception\u0027: e})"},{"line_number":318,"context_line":""},{"line_number":319,"context_line":"            msg \u003d _(\u0027An unknown error has occurred. \u0027"},{"line_number":320,"context_line":"                    \u0027Please try your request again.\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_514bf12a","line":317,"in_reply_to":"fa81d914_4e3b513a","updated":"2015-01-28 19:20:00.000000000","message":"Done","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"df9c5fed8ca55c256054cd64e8039b9ca72c1cbb","unresolved":false,"context_lines":[{"line_number":244,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":245,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"},{"line_number":250,"context_line":"            expected_signature \u003d hmac.new("}],"source_content_type":"text/x-python","patch_set":10,"id":"3acd31a7_44c0812a","line":247,"updated":"2015-05-02 09:26:50.000000000","message":"do we not need to ensure that this headers are passed as handle_instance_id_request function does?","commit_id":"d3531c052c7782acaa3f1e52f450cd631b649e35"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"3801237ae37078930cfd6954043c0c2b905b0ee8","unresolved":false,"context_lines":[{"line_number":316,"context_line":"                                                         instance_address)"},{"line_number":317,"context_line":"        except Exception:"},{"line_number":318,"context_line":"            if instance_id:"},{"line_number":319,"context_line":"                LOG.exception(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":320,"context_line":"                                  \u0027%s\u0027), instance_id)"},{"line_number":321,"context_line":"            else:"},{"line_number":322,"context_line":"                LOG.exception(_LE(\u0027Failed to get instance id for metadata \u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"7a016987_c74f6332","line":319,"updated":"2015-05-22 16:32:52.000000000","message":"This will log an exception and traceback in the logs if the instance is deleted. That doesn\u0027t seem reasonable or responsible. I think you need to catch specific exceptions here and do the right thing to help avoid that.","commit_id":"1b09113f0e84474ea380bfbc9bce6e85aad71164"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"f6d87dd590bd645d4fff7236b0f11dfa2203a297","unresolved":false,"context_lines":[{"line_number":316,"context_line":"                                                         instance_address)"},{"line_number":317,"context_line":"        except Exception:"},{"line_number":318,"context_line":"            if instance_id:"},{"line_number":319,"context_line":"                LOG.exception(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":320,"context_line":"                                  \u0027%s\u0027), instance_id)"},{"line_number":321,"context_line":"            else:"},{"line_number":322,"context_line":"                LOG.exception(_LE(\u0027Failed to get instance id for metadata \u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"7a016987_256176a9","line":319,"in_reply_to":"7a016987_c74f6332","updated":"2015-05-25 07:52:05.000000000","message":"the neutron list_ports can fail for a number of reasons. it is problematic here to catch specific exceptions.\nWe will not gen an exception if the instance is not found.\nI have changed the LOG.exception to LOG.error","commit_id":"1b09113f0e84474ea380bfbc9bce6e85aad71164"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"94eb04e8db1c0db4f3587225d8e0daf88a46f6b8","unresolved":false,"context_lines":[{"line_number":274,"context_line":"        neutron \u003d neutronapi.get_client(context, admin\u003dTrue)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"        # Tenant, instance ids are found in the following method:"},{"line_number":277,"context_line":"        #  X-Metadata-Provider contains id of the metadata provider, and since"},{"line_number":278,"context_line":"        #  overlapping networks cannot be connected to the same metadata"},{"line_number":279,"context_line":"        #  provider, the combo of tenant\u0027s instance IP and the metadata"},{"line_number":280,"context_line":"        #  provider has to be unique."}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_b03fcdd5","line":277,"updated":"2015-06-05 05:09:00.000000000","message":"I can find zero documentation online about these X-Metadata-Provider and X-Metadata-Provider-Signature HTTP headers. Are these specific to something VMWare?\n\nAlso, what does this have to do with VMWare NSXv?","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ffaef7839f1b99f88fa6f4872d81ac1ab4ef374c","unresolved":false,"context_lines":[{"line_number":274,"context_line":"        neutron \u003d neutronapi.get_client(context, admin\u003dTrue)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"        # Tenant, instance ids are found in the following method:"},{"line_number":277,"context_line":"        #  X-Metadata-Provider contains id of the metadata provider, and since"},{"line_number":278,"context_line":"        #  overlapping networks cannot be connected to the same metadata"},{"line_number":279,"context_line":"        #  provider, the combo of tenant\u0027s instance IP and the metadata"},{"line_number":280,"context_line":"        #  provider has to be unique."}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_c02271b9","line":277,"in_reply_to":"3afb71cf_b03fcdd5","updated":"2015-06-05 11:07:38.000000000","message":"In the Neutron DHCP agent there is a proxy that does introspection from the guest to provide a instance hint for the metadata. This is due to the fact that Neutron allows overlapping subnets. https://github.com/openstack/neutron/blob/master/neutron/agent/metadata/agent.py#L218\n\nThe NSXv does not have the option of using this proxy. That is, we have an edge appliance that does the DHCP service. Sadly there is no option of having the DHCP service provide the metadata hint from the guest. This is done via a load balancing configuration that injects the \u0027X-Metadata-Provider\u0027. I will post documentation on that. It was posted when we proposed the neutron implementation and my bad that it got lost.\nThis can actually be done by any load balancer.","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"94eb04e8db1c0db4f3587225d8e0daf88a46f6b8","unresolved":false,"context_lines":[{"line_number":302,"context_line":"                context,"},{"line_number":303,"context_line":"                fixed_ips\u003d\u0027ip_address\u003d\u0027 + instance_address,"},{"line_number":304,"context_line":"                network_id\u003dmd_networks,"},{"line_number":305,"context_line":"                fields\u003d[\u0027device_id\u0027, \u0027tenant_id\u0027])[\u0027ports\u0027][0]"},{"line_number":306,"context_line":""},{"line_number":307,"context_line":"            instance_id \u003d instance_data[\u0027device_id\u0027]"},{"line_number":308,"context_line":"            tenant_id \u003d instance_data[\u0027tenant_id\u0027]"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_96372ae3","line":305,"updated":"2015-06-05 05:09:00.000000000","message":"So, let me get this right... every single call to the metadata service that hits one of these load balancers (whose purpose is to balance the read load, no?) is going to result in two REST API calls to Neutron in addition to a metadata lookup? Doesn\u0027t particularly seem efficient to me.\n\nIs there no better way of communicating the instance_id? Can\u0027t the X-Instance-Id and X-Tenant-Id standard OpenStack HTTP headers be injected into the proxy\u0027s response stream?","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ffaef7839f1b99f88fa6f4872d81ac1ab4ef374c","unresolved":false,"context_lines":[{"line_number":302,"context_line":"                context,"},{"line_number":303,"context_line":"                fixed_ips\u003d\u0027ip_address\u003d\u0027 + instance_address,"},{"line_number":304,"context_line":"                network_id\u003dmd_networks,"},{"line_number":305,"context_line":"                fields\u003d[\u0027device_id\u0027, \u0027tenant_id\u0027])[\u0027ports\u0027][0]"},{"line_number":306,"context_line":""},{"line_number":307,"context_line":"            instance_id \u003d instance_data[\u0027device_id\u0027]"},{"line_number":308,"context_line":"            tenant_id \u003d instance_data[\u0027tenant_id\u0027]"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_3304fd13","line":305,"in_reply_to":"3afb71cf_96372ae3","updated":"2015-06-05 11:07:38.000000000","message":"This actually has less calls than the one in the link provided above. Let me post the details and then that will pain a better picture. \nIt is also more robust as the service is highlya available. In Neutron today if the metadata proxy dies then there is not metadata for the guests.","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"94eb04e8db1c0db4f3587225d8e0daf88a46f6b8","unresolved":false,"context_lines":[{"line_number":314,"context_line":""},{"line_number":315,"context_line":"            meta_data \u003d self.get_metadata_by_instance_id(instance_id,"},{"line_number":316,"context_line":"                                                         instance_address)"},{"line_number":317,"context_line":"        except Exception:"},{"line_number":318,"context_line":"            if instance_id:"},{"line_number":319,"context_line":"                LOG.error(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":320,"context_line":"                              \u0027%s\u0027), instance_id)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_d011295f","line":317,"updated":"2015-06-05 05:09:00.000000000","message":"Please use something more specific than the general Exception class. In addition, please log the error message.","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"34cb8227d4072e8b57bde87332ad4ac93cc86bb3","unresolved":false,"context_lines":[{"line_number":314,"context_line":""},{"line_number":315,"context_line":"            meta_data \u003d self.get_metadata_by_instance_id(instance_id,"},{"line_number":316,"context_line":"                                                         instance_address)"},{"line_number":317,"context_line":"        except Exception:"},{"line_number":318,"context_line":"            if instance_id:"},{"line_number":319,"context_line":"                LOG.error(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":320,"context_line":"                              \u0027%s\u0027), instance_id)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_8f3da1bd","line":317,"in_reply_to":"3afb71cf_d011295f","updated":"2015-06-07 12:36:35.000000000","message":"I have logged the exception. Sadly neutron does not have specific exceptions that we can handle here.","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":120,"context_line":"            return req.response"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        if CONF.neutron.service_metadata_proxy:"},{"line_number":123,"context_line":"            if req.headers.get(\u0027X-Metadata-Provider\u0027):"},{"line_number":124,"context_line":"                meta_data \u003d self._handle_instance_id_request_from_lb(req)"},{"line_number":125,"context_line":"            else:"},{"line_number":126,"context_line":"                meta_data \u003d self._handle_instance_id_request(req)"}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_11674826","line":123,"updated":"2015-06-16 05:37:18.000000000","message":"Is it possible that both types of requests can be received in a cloud deployment? Or if the deployment uses LB, then all metadata requests will be passed through LB and hence include this header only?","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        remote_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        # Ensure that only one header was passed"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"        if instance_id is None:"},{"line_number":185,"context_line":"            msg \u003d _(\u0027X-Instance-ID header is missing from request.\u0027)"},{"line_number":186,"context_line":"        elif signature is None:"}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_f112e4b3","line":183,"updated":"2015-06-16 05:37:18.000000000","message":"[1]","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":196,"context_line":""},{"line_number":197,"context_line":"        if msg:"},{"line_number":198,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        expected_signature \u003d hmac.new("},{"line_number":201,"context_line":"            CONF.neutron.metadata_proxy_shared_secret,"},{"line_number":202,"context_line":"            instance_id,"}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_7cca2b70","line":199,"updated":"2015-06-16 05:37:18.000000000","message":"[2]","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":244,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":245,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"},{"line_number":250,"context_line":"            expected_signature \u003d hmac.new("}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_31ae0c86","line":247,"updated":"2015-06-16 05:37:18.000000000","message":"Should we ensure that all requested headers are passed as it is done above (see [1])","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"},{"line_number":250,"context_line":"            expected_signature \u003d hmac.new("},{"line_number":251,"context_line":"                CONF.neutron.metadata_proxy_shared_secret,"},{"line_number":252,"context_line":"                provider_id,"}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_9c828fff","line":249,"updated":"2015-06-16 05:37:18.000000000","message":"Ulike above (see [2]) signature validation is optional here. Is it intentionally designed or a temporary solution for debug purposes?","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":298,"context_line":"        instance_id \u003d None"},{"line_number":299,"context_line":"        try:"},{"line_number":300,"context_line":"            # Retrieve the instance data from the instance\u0027s port"},{"line_number":301,"context_line":"            instance_data \u003d neutron.list_ports("},{"line_number":302,"context_line":"                context,"},{"line_number":303,"context_line":"                fixed_ips\u003d\u0027ip_address\u003d\u0027 + instance_address,"},{"line_number":304,"context_line":"                network_id\u003dmd_networks,"}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_11e188d0","line":301,"updated":"2015-06-16 05:37:18.000000000","message":"Why do we need to include this call to try block, but do not need it for list_subnets?","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"e5b5c129979ed500e1071a1366b8b3022ace151c","unresolved":false,"context_lines":[{"line_number":316,"context_line":"                                                         instance_address)"},{"line_number":317,"context_line":"        except Exception as e:"},{"line_number":318,"context_line":"            if instance_id:"},{"line_number":319,"context_line":"                LOG.error(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":320,"context_line":"                              \u0027%(instance_id)s. Error: %(error)s\u0027),"},{"line_number":321,"context_line":"                          {\u0027instance_id\u0027: instance_id, \u0027error\u0027: e})"},{"line_number":322,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"fa32b979_31dccc11","line":319,"updated":"2015-06-16 05:37:18.000000000","message":"Perhaps LOG.exception is more appropriate?","commit_id":"2997f4500421797f051b422865dec56c44eac2f6"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"71f4a1ad041c94a1bc7d4baa3855299f8442f509","unresolved":false,"context_lines":[{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"},{"line_number":250,"context_line":"            expected_signature \u003d hmac.new("},{"line_number":251,"context_line":"                CONF.neutron.metadata_proxy_shared_secret,"},{"line_number":252,"context_line":"                provider_id,"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a41bdd9_58b8b8e5","line":249,"updated":"2015-07-17 09:14:48.000000000","message":"I don\u0027t understand why thats optional here.","commit_id":"0cb1b16831b8731a37c3c86be61adddc95bd78e7"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"0f1dcbc0db2079181b298ffaaea2ac56bb9cff09","unresolved":false,"context_lines":[{"line_number":250,"context_line":"            expected_signature \u003d hmac.new("},{"line_number":251,"context_line":"                CONF.neutron.metadata_proxy_shared_secret,"},{"line_number":252,"context_line":"                provider_id,"},{"line_number":253,"context_line":"                hashlib.sha256).hexdigest()"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"            if not utils.constant_time_compare(expected_signature, signature):"},{"line_number":256,"context_line":"                if provider_id:"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a41bdd9_fdac1e37","line":253,"updated":"2015-07-17 08:56:29.000000000","message":"Feels like we want to reach out to the security folks about this.","commit_id":"0cb1b16831b8731a37c3c86be61adddc95bd78e7"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"71f4a1ad041c94a1bc7d4baa3855299f8442f509","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        #  X-Metadata-Provider contains id of the metadata provider, and since"},{"line_number":278,"context_line":"        #  overlapping networks cannot be connected to the same metadata"},{"line_number":279,"context_line":"        #  provider, the combo of tenant\u0027s instance IP and the metadata"},{"line_number":280,"context_line":"        #  provider has to be unique."},{"line_number":281,"context_line":"        #"},{"line_number":282,"context_line":"        #  The networks which are connected to the metadata provider are"},{"line_number":283,"context_line":"        #  retrieved in the 1st call to neutron.list_subnets()"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a41bdd9_18ad5031","line":280,"updated":"2015-07-17 09:14:48.000000000","message":"I don\u0027t see why they have to be unique? I think I missing something.","commit_id":"0cb1b16831b8731a37c3c86be61adddc95bd78e7"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"01f7470cf01a96562bc182f4bcaa877051382a88","unresolved":false,"context_lines":[{"line_number":197,"context_line":"        if msg:"},{"line_number":198,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        expected_signature \u003d hmac.new("},{"line_number":201,"context_line":"            CONF.neutron.metadata_proxy_shared_secret,"},{"line_number":202,"context_line":"            instance_id,"},{"line_number":203,"context_line":"            hashlib.sha256).hexdigest()"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_5a21164c","line":200,"updated":"2015-07-28 13:54:06.000000000","message":"feels like we can share code with most of the bits after this point.\n\njust need instance_id and provider_id to move to signature_id, I think?","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0b00611229e7c9f0764ebdf7c73aa075a8207123","unresolved":false,"context_lines":[{"line_number":197,"context_line":"        if msg:"},{"line_number":198,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        expected_signature \u003d hmac.new("},{"line_number":201,"context_line":"            CONF.neutron.metadata_proxy_shared_secret,"},{"line_number":202,"context_line":"            instance_id,"},{"line_number":203,"context_line":"            hashlib.sha256).hexdigest()"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_2b3929a4","line":200,"in_reply_to":"3a50d1a3_5a21164c","updated":"2015-07-29 13:18:17.000000000","message":"Done","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"01f7470cf01a96562bc182f4bcaa877051382a88","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":244,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":245,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_f71d9b73","line":246,"updated":"2015-07-28 13:54:06.000000000","message":"I think the above code raises raises webob.exc.HTTPBadRequest(explanation\u003dmsg) if the signature is missing. Maybe we should do that here?","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"42b4d2eb80734dfbb1f836978e5ec5d287254df5","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":244,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":245,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a4dcd0f_176be31f","line":246,"in_reply_to":"3a50d1a3_8beabdd6","updated":"2015-08-04 09:22:15.000000000","message":"Hmm, interesting.\n\nI am not sure it should be.","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0b00611229e7c9f0764ebdf7c73aa075a8207123","unresolved":false,"context_lines":[{"line_number":243,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":244,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":245,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":246,"context_line":"        signature \u003d req.headers.get(\u0027X-Metadata-Provider-Signature\u0027)"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        # If authentication token is set, authenticate"},{"line_number":249,"context_line":"        if CONF.neutron.metadata_proxy_shared_secret:"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_8beabdd6","line":246,"in_reply_to":"3a50d1a3_f71d9b73","updated":"2015-07-29 13:18:17.000000000","message":"the signature is optional and only used if CONF.neutron.metadata_proxy_shared_secret is set.\nI will only read that value of the flag is set.","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"01f7470cf01a96562bc182f4bcaa877051382a88","unresolved":false,"context_lines":[{"line_number":266,"context_line":"                                 \u0027provider_id\u0027: provider_id})"},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"                msg \u003d _(\u0027Invalid proxy request signature.\u0027)"},{"line_number":269,"context_line":"                raise webob.exc.HTTPForbidden(explanation\u003dmsg)"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        # We use admin context, admin\u003dTrue to lookup the"},{"line_number":272,"context_line":"        # inter-Edge network port"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_57032f42","line":269,"updated":"2015-07-28 13:54:06.000000000","message":"So this seems like really bad code repetition with the above code, I am wondering if we can share more code here?\n\nI know its provider_id vs instance_id.","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0b00611229e7c9f0764ebdf7c73aa075a8207123","unresolved":false,"context_lines":[{"line_number":266,"context_line":"                                 \u0027provider_id\u0027: provider_id})"},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"                msg \u003d _(\u0027Invalid proxy request signature.\u0027)"},{"line_number":269,"context_line":"                raise webob.exc.HTTPForbidden(explanation\u003dmsg)"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"        # We use admin context, admin\u003dTrue to lookup the"},{"line_number":272,"context_line":"        # inter-Edge network port"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_8ba63da9","line":269,"in_reply_to":"3a50d1a3_57032f42","updated":"2015-07-29 13:18:17.000000000","message":"Done","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"01f7470cf01a96562bc182f4bcaa877051382a88","unresolved":false,"context_lines":[{"line_number":310,"context_line":"            # instance_data is unicode-encoded, while memorycache doesn\u0027t like"},{"line_number":311,"context_line":"            # that. Therefore we convert to str"},{"line_number":312,"context_line":"            if isinstance(instance_id, unicode):"},{"line_number":313,"context_line":"                instance_id \u003d instance_id.encode(\u0027utf-8\u0027)"},{"line_number":314,"context_line":""},{"line_number":315,"context_line":"            meta_data \u003d self.get_metadata_by_instance_id(instance_id,"},{"line_number":316,"context_line":"                                                         instance_address)"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_ba593aff","line":313,"updated":"2015-07-28 13:54:06.000000000","message":"I think the readability of this will be much easier if this is all extracted into a method that is something like:\n\ninstance_uuid, tenant \u003d _find_instance_and_tenant(instance_address, provider_id)\n\nOnce you do that, it should be clear what needs to be passed into the common code shared between these two methods here.","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0b00611229e7c9f0764ebdf7c73aa075a8207123","unresolved":false,"context_lines":[{"line_number":310,"context_line":"            # instance_data is unicode-encoded, while memorycache doesn\u0027t like"},{"line_number":311,"context_line":"            # that. Therefore we convert to str"},{"line_number":312,"context_line":"            if isinstance(instance_id, unicode):"},{"line_number":313,"context_line":"                instance_id \u003d instance_id.encode(\u0027utf-8\u0027)"},{"line_number":314,"context_line":""},{"line_number":315,"context_line":"            meta_data \u003d self.get_metadata_by_instance_id(instance_id,"},{"line_number":316,"context_line":"                                                         instance_address)"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_ce93f3a1","line":313,"in_reply_to":"3a50d1a3_ba593aff","updated":"2015-07-29 13:18:17.000000000","message":"Done","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"01f7470cf01a96562bc182f4bcaa877051382a88","unresolved":false,"context_lines":[{"line_number":331,"context_line":""},{"line_number":332,"context_line":"            msg \u003d _(\u0027An unknown error has occurred. \u0027"},{"line_number":333,"context_line":"                    \u0027Please try your request again.\u0027)"},{"line_number":334,"context_line":"            raise webob.exc.HTTPInternalServerError(explanation\u003dmsg)"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"        if meta_data is None:"},{"line_number":337,"context_line":"            LOG.error(_(\u0027Failed to get metadata for instance id: %s\u0027),"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_ba9a9a60","line":334,"updated":"2015-07-28 13:54:06.000000000","message":"I think it should be BadRequest, for the expected errors (like a unknown instance id)","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0b00611229e7c9f0764ebdf7c73aa075a8207123","unresolved":false,"context_lines":[{"line_number":331,"context_line":""},{"line_number":332,"context_line":"            msg \u003d _(\u0027An unknown error has occurred. \u0027"},{"line_number":333,"context_line":"                    \u0027Please try your request again.\u0027)"},{"line_number":334,"context_line":"            raise webob.exc.HTTPInternalServerError(explanation\u003dmsg)"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"        if meta_data is None:"},{"line_number":337,"context_line":"            LOG.error(_(\u0027Failed to get metadata for instance id: %s\u0027),"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_ae746767","line":334,"in_reply_to":"3a50d1a3_ba9a9a60","updated":"2015-07-29 13:18:17.000000000","message":"Done","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"01f7470cf01a96562bc182f4bcaa877051382a88","unresolved":false,"context_lines":[{"line_number":333,"context_line":"                    \u0027Please try your request again.\u0027)"},{"line_number":334,"context_line":"            raise webob.exc.HTTPInternalServerError(explanation\u003dmsg)"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"        if meta_data is None:"},{"line_number":337,"context_line":"            LOG.error(_(\u0027Failed to get metadata for instance id: %s\u0027),"},{"line_number":338,"context_line":"                      instance_id)"},{"line_number":339,"context_line":"        elif meta_data.instance[\u0027project_id\u0027] !\u003d tenant_id:"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_3a99aa79","line":336,"updated":"2015-07-28 13:54:06.000000000","message":"Feels like we are back to shared code here.","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0b00611229e7c9f0764ebdf7c73aa075a8207123","unresolved":false,"context_lines":[{"line_number":333,"context_line":"                    \u0027Please try your request again.\u0027)"},{"line_number":334,"context_line":"            raise webob.exc.HTTPInternalServerError(explanation\u003dmsg)"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"        if meta_data is None:"},{"line_number":337,"context_line":"            LOG.error(_(\u0027Failed to get metadata for instance id: %s\u0027),"},{"line_number":338,"context_line":"                      instance_id)"},{"line_number":339,"context_line":"        elif meta_data.instance[\u0027project_id\u0027] !\u003d tenant_id:"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a50d1a3_eef02fff","line":336,"in_reply_to":"3a50d1a3_3a99aa79","updated":"2015-07-29 13:18:17.000000000","message":"Done","commit_id":"12026e471d8eb720e6749bb242842619f6321077"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"b020f39471a0f0a7b24f5846c60b54641edd5eae","unresolved":false,"context_lines":[{"line_number":312,"context_line":"        return instance_id, tenant_id"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":315,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":316,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":317,"context_line":""},{"line_number":318,"context_line":"        # If authentication token is set, authenticate"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a4dcd0f_3dc86274","line":315,"updated":"2015-08-03 16:48:40.000000000","message":"If X-Forwarded-For is missing, or badly formatted, this will fail badly, rather than returning bad request.\n\nits probably good to state why we can\u0027t use what it used above in line 225:\n\nremote_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027)","commit_id":"b59899105d4006491d4bdd786119d6a3a78f1c77"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"9c33044627e9dec8d84bd3ee45487547901a9465","unresolved":false,"context_lines":[{"line_number":312,"context_line":"        return instance_id, tenant_id"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":315,"context_line":"        instance_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027).split(\u0027,\u0027)[0]"},{"line_number":316,"context_line":"        provider_id \u003d req.headers.get(\u0027X-Metadata-Provider\u0027)"},{"line_number":317,"context_line":""},{"line_number":318,"context_line":"        # If authentication token is set, authenticate"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a4dcd0f_c93ae0e7","line":315,"in_reply_to":"1a4dcd0f_3dc86274","updated":"2015-08-03 18:28:40.000000000","message":"Done","commit_id":"b59899105d4006491d4bdd786119d6a3a78f1c77"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"519954babc521939b4815ed3ecd83d0e7d8eb673","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        return meta_data"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _validate_shared_secret(self, requestor_id, signature,"},{"line_number":177,"context_line":"                                requestor_address):"},{"line_number":178,"context_line":"        expected_signature \u003d hmac.new("},{"line_number":179,"context_line":"            CONF.neutron.metadata_proxy_shared_secret,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_d20029ad","line":176,"updated":"2015-08-04 09:37:31.000000000","message":"micro nit: I would move this down the file, so it reads better, under _handle_instance_id_request and _handle_instance_id_request_from_lb","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8cd4111e1b1eeea7b4f75de2b94d6d9a9f997b3a","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        return meta_data"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _validate_shared_secret(self, requestor_id, signature,"},{"line_number":177,"context_line":"                                requestor_address):"},{"line_number":178,"context_line":"        expected_signature \u003d hmac.new("},{"line_number":179,"context_line":"            CONF.neutron.metadata_proxy_shared_secret,"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_ba5c4f26","line":176,"in_reply_to":"1a4dcd0f_d20029ad","updated":"2015-08-04 10:51:20.000000000","message":"Done","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"519954babc521939b4815ed3ecd83d0e7d8eb673","unresolved":false,"context_lines":[{"line_number":194,"context_line":"            msg \u003d _(\u0027Invalid proxy request signature.\u0027)"},{"line_number":195,"context_line":"            raise webob.exc.HTTPForbidden(explanation\u003dmsg)"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    def _get_meta_by_instance_id(self, instance_id, tenant_id, remote_address):"},{"line_number":198,"context_line":"        try:"},{"line_number":199,"context_line":"            meta_data \u003d self.get_metadata_by_instance_id(instance_id,"},{"line_number":200,"context_line":"                                                         remote_address)"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_722cb54a","line":197,"updated":"2015-08-04 09:37:31.000000000","message":"micro nit: I would move this down the file, so it reads better.","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8cd4111e1b1eeea7b4f75de2b94d6d9a9f997b3a","unresolved":false,"context_lines":[{"line_number":194,"context_line":"            msg \u003d _(\u0027Invalid proxy request signature.\u0027)"},{"line_number":195,"context_line":"            raise webob.exc.HTTPForbidden(explanation\u003dmsg)"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    def _get_meta_by_instance_id(self, instance_id, tenant_id, remote_address):"},{"line_number":198,"context_line":"        try:"},{"line_number":199,"context_line":"            meta_data \u003d self.get_metadata_by_instance_id(instance_id,"},{"line_number":200,"context_line":"                                                         remote_address)"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_1a4c636f","line":197,"in_reply_to":"1a4dcd0f_722cb54a","updated":"2015-08-04 10:51:20.000000000","message":"Done","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"519954babc521939b4815ed3ecd83d0e7d8eb673","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        md_networks \u003d [subnet[\u0027network_id\u0027]"},{"line_number":277,"context_line":"                       for subnet in md_subnets[\u0027subnets\u0027]]"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"        instance_id \u003d None"},{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            # Retrieve the instance data from the instance\u0027s port"},{"line_number":282,"context_line":"            instance_data \u003d neutron.list_ports("}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_72e9151a","line":279,"updated":"2015-08-04 09:37:31.000000000","message":"why is this here, if its only used assigned on line 305?","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8cd4111e1b1eeea7b4f75de2b94d6d9a9f997b3a","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        md_networks \u003d [subnet[\u0027network_id\u0027]"},{"line_number":277,"context_line":"                       for subnet in md_subnets[\u0027subnets\u0027]]"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"        instance_id \u003d None"},{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            # Retrieve the instance data from the instance\u0027s port"},{"line_number":282,"context_line":"            instance_data \u003d neutron.list_ports("}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_dad03b56","line":279,"in_reply_to":"1a4dcd0f_72e9151a","updated":"2015-08-04 10:51:20.000000000","message":"Done","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"519954babc521939b4815ed3ecd83d0e7d8eb673","unresolved":false,"context_lines":[{"line_number":285,"context_line":"                network_id\u003dmd_networks,"},{"line_number":286,"context_line":"                fields\u003d[\u0027device_id\u0027, \u0027tenant_id\u0027])[\u0027ports\u0027][0]"},{"line_number":287,"context_line":"        except Exception as e:"},{"line_number":288,"context_line":"            if instance_id:"},{"line_number":289,"context_line":"                LOG.error(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":290,"context_line":"                              \u0027%(instance_id)s. Error: %(error)s\u0027),"},{"line_number":291,"context_line":"                          {\u0027instance_id\u0027: instance_id, \u0027error\u0027: e})"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_f2968593","line":288,"updated":"2015-08-04 09:37:31.000000000","message":"how can this ever by true?","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8cd4111e1b1eeea7b4f75de2b94d6d9a9f997b3a","unresolved":false,"context_lines":[{"line_number":285,"context_line":"                network_id\u003dmd_networks,"},{"line_number":286,"context_line":"                fields\u003d[\u0027device_id\u0027, \u0027tenant_id\u0027])[\u0027ports\u0027][0]"},{"line_number":287,"context_line":"        except Exception as e:"},{"line_number":288,"context_line":"            if instance_id:"},{"line_number":289,"context_line":"                LOG.error(_LE(\u0027Failed to get metadata for instance id: \u0027"},{"line_number":290,"context_line":"                              \u0027%(instance_id)s. Error: %(error)s\u0027),"},{"line_number":291,"context_line":"                          {\u0027instance_id\u0027: instance_id, \u0027error\u0027: e})"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_9acab3a0","line":288,"in_reply_to":"1a4dcd0f_f2968593","updated":"2015-08-04 10:51:20.000000000","message":"Done","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"519954babc521939b4815ed3ecd83d0e7d8eb673","unresolved":false,"context_lines":[{"line_number":308,"context_line":"        # instance_data is unicode-encoded, while memorycache doesn\u0027t like"},{"line_number":309,"context_line":"        # that. Therefore we convert to str"},{"line_number":310,"context_line":"        if isinstance(instance_id, unicode):"},{"line_number":311,"context_line":"            instance_id \u003d instance_id.encode(\u0027utf-8\u0027)"},{"line_number":312,"context_line":"        return instance_id, tenant_id"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_52465924","line":311,"updated":"2015-08-04 09:37:31.000000000","message":"why not just do str(instance_id) or similar.\n\nnot sure how this works in py3.4 though, I guess there must be a pattern for this.","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8cd4111e1b1eeea7b4f75de2b94d6d9a9f997b3a","unresolved":false,"context_lines":[{"line_number":308,"context_line":"        # instance_data is unicode-encoded, while memorycache doesn\u0027t like"},{"line_number":309,"context_line":"        # that. Therefore we convert to str"},{"line_number":310,"context_line":"        if isinstance(instance_id, unicode):"},{"line_number":311,"context_line":"            instance_id \u003d instance_id.encode(\u0027utf-8\u0027)"},{"line_number":312,"context_line":"        return instance_id, tenant_id"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_1a1b031d","line":311,"in_reply_to":"1a4dcd0f_52465924","updated":"2015-08-04 10:51:20.000000000","message":"the str(instance_id) did not work. this is due to the value being encoded. we tried that (honestly this was 6 months ago when we posted the code)","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"519954babc521939b4815ed3ecd83d0e7d8eb673","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            instance_id \u003d instance_id.encode(\u0027utf-8\u0027)"},{"line_number":312,"context_line":"        return instance_id, tenant_id"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":315,"context_line":"        remote_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027)"},{"line_number":316,"context_line":"        if remote_address is None:"},{"line_number":317,"context_line":"            msg \u003d _(\u0027X-Forwarded-For is missing from request.\u0027)"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_f2e76510","line":314,"updated":"2015-08-04 09:37:31.000000000","message":"micro nit, I would move this so it sits directly under _handle_instance_id_request as I think that would read better.","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8cd4111e1b1eeea7b4f75de2b94d6d9a9f997b3a","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            instance_id \u003d instance_id.encode(\u0027utf-8\u0027)"},{"line_number":312,"context_line":"        return instance_id, tenant_id"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"    def _handle_instance_id_request_from_lb(self, req):"},{"line_number":315,"context_line":"        remote_address \u003d req.headers.get(\u0027X-Forwarded-For\u0027)"},{"line_number":316,"context_line":"        if remote_address is None:"},{"line_number":317,"context_line":"            msg \u003d _(\u0027X-Forwarded-For is missing from request.\u0027)"}],"source_content_type":"text/x-python","patch_set":22,"id":"1a4dcd0f_fa63b7af","line":314,"in_reply_to":"1a4dcd0f_f2e76510","updated":"2015-08-04 10:51:20.000000000","message":"Done","commit_id":"7532523d98fa7b2c32872931533021ec0efd1fd1"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"0ed610e0e383f8ff1c258e3b7a910e3403f5f6f8","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        return self._get_meta_by_instance_id(instance_id, tenant_id,"},{"line_number":204,"context_line":"                                             remote_address)"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"    def _get_instance_id_from_lb(self, provider_id, instance_address):"},{"line_number":207,"context_line":"        # We use admin context, admin\u003dTrue to lookup the"},{"line_number":208,"context_line":"        # inter-Edge network port"},{"line_number":209,"context_line":"        context \u003d nova_context.get_admin_context()"}],"source_content_type":"text/x-python","patch_set":23,"id":"1a4dcd0f_5a550b4e","line":206,"updated":"2015-08-04 11:00:48.000000000","message":"I would move this below _handle_instance_id_request_from_lb myself, maybe below _get_meta_by_instance_id, but thats a nit.","commit_id":"622a845b757aa35932f703963beffc764d8ae244"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c3ad4a897e38790c16e1b221136d65e0e3c935b5","unresolved":false,"context_lines":[{"line_number":236,"context_line":"            instance_data \u003d neutron.list_ports("},{"line_number":237,"context_line":"                context,"},{"line_number":238,"context_line":"                fixed_ips\u003d\u0027ip_address\u003d\u0027 + instance_address,"},{"line_number":239,"context_line":"                network_id\u003dmd_networks,"},{"line_number":240,"context_line":"                fields\u003d[\u0027device_id\u0027, \u0027tenant_id\u0027])[\u0027ports\u0027][0]"},{"line_number":241,"context_line":"        except Exception as e:"},{"line_number":242,"context_line":"            LOG.error(_LE(\u0027Failed to get instance id for metadata \u0027"}],"source_content_type":"text/x-python","patch_set":23,"id":"1a4dcd0f_9126f5cc","line":239,"updated":"2015-08-04 21:25:16.000000000","message":"I\u0027m going to assume network_id is supposed to be a list even though the name is singular","commit_id":"622a845b757aa35932f703963beffc764d8ae244"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"0ed610e0e383f8ff1c258e3b7a910e3403f5f6f8","unresolved":false,"context_lines":[{"line_number":239,"context_line":"                network_id\u003dmd_networks,"},{"line_number":240,"context_line":"                fields\u003d[\u0027device_id\u0027, \u0027tenant_id\u0027])[\u0027ports\u0027][0]"},{"line_number":241,"context_line":"        except Exception as e:"},{"line_number":242,"context_line":"            LOG.error(_LE(\u0027Failed to get instance id for metadata \u0027"},{"line_number":243,"context_line":"                          \u0027request, provider %(provider)s \u0027"},{"line_number":244,"context_line":"                          \u0027networks %(networks)s \u0027"},{"line_number":245,"context_line":"                          \u0027requester %(requester)s. Error: %(error)s\u0027),"}],"source_content_type":"text/x-python","patch_set":23,"id":"1a4dcd0f_3a4cbfc6","line":242,"updated":"2015-08-04 11:00:48.000000000","message":"thank you :)","commit_id":"622a845b757aa35932f703963beffc764d8ae244"}],"nova/tests/unit/test_metadata.py":[{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"584eeb9609f46acdbf66205e90416be819da84d8","unresolved":false,"context_lines":[{"line_number":845,"context_line":"        self.assertEqual(200, response.status_int)"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":848,"context_line":"    def test_metadata_lb_proxy_chain(self, mock_get_client):"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"        def fake_get_metadata(instance_id, remote_address):"},{"line_number":851,"context_line":"            if remote_address is None:"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_0e507931","line":848,"updated":"2015-01-28 18:14:17.000000000","message":"Sorry what is this testing? Why do you end the method name in _chain?","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"455eabf319dab55639add7ebedaba7974b1c14cc","unresolved":false,"context_lines":[{"line_number":845,"context_line":"        self.assertEqual(200, response.status_int)"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":848,"context_line":"    def test_metadata_lb_proxy_chain(self, mock_get_client):"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"        def fake_get_metadata(instance_id, remote_address):"},{"line_number":851,"context_line":"            if remote_address is None:"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_51205149","line":848,"in_reply_to":"fa81d914_0e507931","updated":"2015-01-28 19:20:00.000000000","message":"this is testing a case where there is a loadbalancer between nova and neutron (this is for HA between the services). that load balancer may append its own X forwarded for. This is to check that use case.","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"584eeb9609f46acdbf66205e90416be819da84d8","unresolved":false,"context_lines":[{"line_number":847,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":848,"context_line":"    def test_metadata_lb_proxy_chain(self, mock_get_client):"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"        def fake_get_metadata(instance_id, remote_address):"},{"line_number":851,"context_line":"            if remote_address is None:"},{"line_number":852,"context_line":"                raise Exception(\u0027Expected X-Forwared-For header\u0027)"},{"line_number":853,"context_line":"            elif instance_id \u003d\u003d expected_instance_id:"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_4ea51152","line":850,"updated":"2015-01-28 18:14:17.000000000","message":"This method is duplicated above and below. Can we pull this out so we don\u0027t duplicated it.","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"455eabf319dab55639add7ebedaba7974b1c14cc","unresolved":false,"context_lines":[{"line_number":847,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":848,"context_line":"    def test_metadata_lb_proxy_chain(self, mock_get_client):"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"        def fake_get_metadata(instance_id, remote_address):"},{"line_number":851,"context_line":"            if remote_address is None:"},{"line_number":852,"context_line":"                raise Exception(\u0027Expected X-Forwared-For header\u0027)"},{"line_number":853,"context_line":"            elif instance_id \u003d\u003d expected_instance_id:"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_d12b61e9","line":850,"in_reply_to":"fa81d914_4ea51152","updated":"2015-01-28 19:20:00.000000000","message":"Done","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"bc1fe6eb0ef64c6b97688df3fcc333322b0748f8","unresolved":false,"context_lines":[{"line_number":847,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":848,"context_line":"    def test_metadata_lb_proxy_chain(self, mock_get_client):"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"        def fake_get_metadata(instance_id, remote_address):"},{"line_number":851,"context_line":"            if remote_address is None:"},{"line_number":852,"context_line":"                raise Exception(\u0027Expected X-Forwared-For header\u0027)"},{"line_number":853,"context_line":"            elif instance_id \u003d\u003d expected_instance_id:"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa81d914_14e887b3","line":850,"in_reply_to":"fa81d914_d12b61e9","updated":"2015-01-28 19:36:54.000000000","message":"sorry was unable to do this in a trivial way. we need to duplicate this.","commit_id":"c6cf7878f4a97c6f7e4711a9bef703399e722ad1"},{"author":{"_account_id":9423,"name":"Roey Chen","email":"roeyc@vmware.com","username":"roeyc"},"change_message_id":"b7236a29f3aa8e831ed8af2cd1cd8db846478344","unresolved":false,"context_lines":[{"line_number":904,"context_line":"        self._metadata_handler_with_remote_address(hnd)"},{"line_number":905,"context_line":"        self._metadata_handler_with_remote_address(hnd)"},{"line_number":906,"context_line":"        self.assertEqual(2, get_by_uuid.call_count)"},{"line_number":907,"context_line":""},{"line_number":908,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":909,"context_line":"    def test_metadata_lb_proxy(self, mock_get_client):"},{"line_number":910,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"7a016987_05b8e90f","line":907,"updated":"2015-05-31 10:48:24.000000000","message":"code duplication can be drasticly reduced between the following three tests","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"34cb8227d4072e8b57bde87332ad4ac93cc86bb3","unresolved":false,"context_lines":[{"line_number":904,"context_line":"        self._metadata_handler_with_remote_address(hnd)"},{"line_number":905,"context_line":"        self._metadata_handler_with_remote_address(hnd)"},{"line_number":906,"context_line":"        self.assertEqual(2, get_by_uuid.call_count)"},{"line_number":907,"context_line":""},{"line_number":908,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":909,"context_line":"    def test_metadata_lb_proxy(self, mock_get_client):"},{"line_number":910,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_2f4ead6f","line":907,"in_reply_to":"3afb71cf_d65b622d","updated":"2015-06-07 12:36:35.000000000","message":"Done","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"94eb04e8db1c0db4f3587225d8e0daf88a46f6b8","unresolved":false,"context_lines":[{"line_number":904,"context_line":"        self._metadata_handler_with_remote_address(hnd)"},{"line_number":905,"context_line":"        self._metadata_handler_with_remote_address(hnd)"},{"line_number":906,"context_line":"        self.assertEqual(2, get_by_uuid.call_count)"},{"line_number":907,"context_line":""},{"line_number":908,"context_line":"    @mock.patch.object(neutronapi, \u0027get_client\u0027, return_value\u003dmock.Mock())"},{"line_number":909,"context_line":"    def test_metadata_lb_proxy(self, mock_get_client):"},{"line_number":910,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3afb71cf_d65b622d","line":907,"in_reply_to":"7a016987_05b8e90f","updated":"2015-06-05 05:09:00.000000000","message":"Agreed, please de-duplicate the test code below.","commit_id":"79bcdeb64fddae4672cdc5654b1a66db2c1516dc"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"71f4a1ad041c94a1bc7d4baa3855299f8442f509","unresolved":false,"context_lines":[{"line_number":694,"context_line":""},{"line_number":695,"context_line":"        self.assertEqual(1, mock_compare.call_count)"},{"line_number":696,"context_line":""},{"line_number":697,"context_line":"    def _fake_x_get_metadata(self, instance_id, remote_address):"},{"line_number":698,"context_line":"        if remote_address is None:"},{"line_number":699,"context_line":"            raise Exception(\u0027Expected X-Forwared-For header\u0027)"},{"line_number":700,"context_line":"        elif instance_id \u003d\u003d self.expected_instance_id:"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a41bdd9_98d72023","line":697,"updated":"2015-07-17 09:14:48.000000000","message":"I didn\u0027t like this move, but it makes sense to get the sharing. between test methods. I have a slight preference for it not to be in the class, but its quite neat here, so thats probably the correct call.","commit_id":"0cb1b16831b8731a37c3c86be61adddc95bd78e7"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"0ed610e0e383f8ff1c258e3b7a910e3403f5f6f8","unresolved":false,"context_lines":[{"line_number":767,"context_line":"    def _fake_x_get_metadata(self, instance_id, remote_address):"},{"line_number":768,"context_line":"        if remote_address is None:"},{"line_number":769,"context_line":"            raise Exception(\u0027Expected X-Forwared-For header\u0027)"},{"line_number":770,"context_line":"        elif instance_id \u003d\u003d self.expected_instance_id:"},{"line_number":771,"context_line":"            return self.mdinst"},{"line_number":772,"context_line":"        else:"},{"line_number":773,"context_line":"            # raise the exception to aid with 500 response code test"}],"source_content_type":"text/x-python","patch_set":23,"id":"1a4dcd0f_da959be4","line":770,"updated":"2015-08-04 11:00:48.000000000","message":"I would have passed in the expected id, myself, rather than setting it on self, but thats a nit really.","commit_id":"622a845b757aa35932f703963beffc764d8ae244"}]}
