)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c11fbc5bf449e9988045e9591f9168a0388aa198","unresolved":true,"context_lines":[{"line_number":7,"context_line":"If endpoint ends with 1 client removes it"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"e.g. Watcher endpoint is \"127.0.0.1:8081\","},{"line_number":10,"context_line":"Watcher client sends http request to \"127.0.0.1:808\""},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Closes-Bug: #2052779"},{"line_number":13,"context_line":"Change-Id: I78631c8a13ff73a236f3bfadd7f4258b254b6113"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"0da5837f_56a13477","line":10,"updated":"2024-12-06 12:59:25.000000000","message":"i can confirm that that is the behaivor in the curren tcode\n\n```\n\u003e\u003e\u003e endpoint \u003d \"http://localhost:8081/\"\n\u003e\u003e\u003e \n\u003e\u003e\u003e API_VERSION \u003d \u0027/v1\u0027\n\u003e\u003e\u003e url\u003dendpoint\n\u003e\u003e\u003e \n\u003e\u003e\u003e url.rstrip(\u0027/\u0027).rstrip(API_VERSION)\n\u0027http://localhost:808\u0027\n\u003e\u003e\u003e endpoint \u003d \"http://127.0.0.1:8081/\"\n\u003e\u003e\u003e url\u003dendpoint\n\u003e\u003e\u003e url.rstrip(\u0027/\u0027).rstrip(API_VERSION)\n\u0027http://127.0.0.1:808\u0027\n\u003e\u003e\u003e \n```","commit_id":"5359e7b4ecd53b95ebe17a7af5a7c063d4eb7cb4"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"6a896f0b7e5dac63185bffe9a4ee0eedfc43ea30","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"d48759af_178cadc7","updated":"2024-11-28 16:46:55.000000000","message":"we proably shoudl add test coverage to this first to repoduce the issue.\n\nim also not sure that using sub is correct as that will replace in the midel fo the string and may replace content that it should not.\n\nbut lest get some clean test results via a rebase first and go form there.\n\nthe bug report looks valid to me and i agree this shoudl be fixed.\n\nwe are currently in the process of revving watchers maintenance so ill add this to the every growing todo list.","commit_id":"46c0b616913b05d5f83c8a69afef6cff8b6bd8aa"},{"author":{"_account_id":32927,"name":"mitya-eremeev-2","display_name":"Mitya Eremeev","email":"mitossvyaz@mail.ru","username":"mitya-eremeev-2"},"change_message_id":"0a3937c340aae0236efc402c3804f148eaa7239c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"75576ed4_26d73c0b","in_reply_to":"d48759af_178cadc7","updated":"2024-12-05 18:50:56.000000000","message":"I added test. Please review patch","commit_id":"46c0b616913b05d5f83c8a69afef6cff8b6bd8aa"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"5d6864af33f8259144a9ec94b0196d5dd574a857","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"53f7cc10_fd7e25be","updated":"2024-12-17 12:46:08.000000000","message":"LGTM, thanks for fixing it","commit_id":"5359e7b4ecd53b95ebe17a7af5a7c063d4eb7cb4"}],"watcherclient/common/httpclient.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"fa278ebbcceed16e8cdcda4166dfbdc0304e4298","unresolved":true,"context_lines":[{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def _trim_endpoint_api_version(url):"},{"line_number":65,"context_line":"    \"\"\"Trim API version and trailing slash from endpoint.\"\"\""},{"line_number":66,"context_line":"    return re.sub(f\u0027{API_VERSION}$\u0027, \u0027\u0027, url.rstrip(\u0027/\u0027))"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"def _extract_error_json(body):"}],"source_content_type":"text/x-python","patch_set":2,"id":"0e412f27_270132ed","line":66,"updated":"2024-11-28 16:52:53.000000000","message":"we may want ot look at how this is haneded in other clients like \n\nhttps://github.com/openstack/python-novaclient/blob/master/novaclient/v2/versions.py#L36-L77","commit_id":"46c0b616913b05d5f83c8a69afef6cff8b6bd8aa"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c11fbc5bf449e9988045e9591f9168a0388aa198","unresolved":true,"context_lines":[{"line_number":63,"context_line":""},{"line_number":64,"context_line":"def _trim_endpoint_api_version(url):"},{"line_number":65,"context_line":"    \"\"\"Trim API version and trailing slash from endpoint.\"\"\""},{"line_number":66,"context_line":"    return re.sub(f\u0027{API_VERSION}$\u0027, \u0027\u0027, url.rstrip(\u0027/\u0027))"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"def _extract_error_json(body):"}],"source_content_type":"text/x-python","patch_set":2,"id":"eaef32ce_661fdc29","line":66,"in_reply_to":"0e412f27_270132ed","updated":"2024-12-06 12:59:25.000000000","message":"with the new formulation this does indeed work as intended\n```\n\u003e\u003e\u003e import re\n\u003e\u003e\u003e endpoint \u003d \"http://localhost:8081/\"\n\u003e\u003e\u003e url\u003dendpoint\n\u003e\u003e\u003e re.sub(f\u0027{API_VERSION}$\u0027, \u0027\u0027, url.rstrip(\u0027/\u0027))\n\u0027http://localhost:8081\u0027\n\u003e\u003e\u003e\n```","commit_id":"46c0b616913b05d5f83c8a69afef6cff8b6bd8aa"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c11fbc5bf449e9988045e9591f9168a0388aa198","unresolved":true,"context_lines":[{"line_number":49,"context_line":"USER_AGENT \u003d \u0027python-watcherclient\u0027"},{"line_number":50,"context_line":"CHUNKSIZE \u003d 1024 * 64  # 64kB"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"API_VERSION \u003d \u0027/v1\u0027"},{"line_number":53,"context_line":"API_VERSION_SELECTED_STATES \u003d (\u0027user\u0027, \u0027negotiated\u0027, \u0027cached\u0027, \u0027default\u0027)"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"897aa89e_b12ad943","line":52,"updated":"2024-12-06 12:59:25.000000000","message":"given the API_VERSION is \u0027/v1\u0027 the chances of sub replaceing that in the wrong part of the url is low.\n\nin the very very unlikely event we ever get to a v10 it would fail but realsitically that is not going to happen","commit_id":"5359e7b4ecd53b95ebe17a7af5a7c063d4eb7cb4"}],"watcherclient/tests/unit/test_client.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c11fbc5bf449e9988045e9591f9168a0388aa198","unresolved":true,"context_lines":[{"line_number":359,"context_line":"        conn_url \u003d client._make_connection_url(url)"},{"line_number":360,"context_line":"        self.assertEqual(expected_url, conn_url)"},{"line_number":361,"context_line":""},{"line_number":362,"context_line":"    def test_port_ends_with_one(self):"},{"line_number":363,"context_line":"        endpoint \u003d \"http://localhost:8081/\""},{"line_number":364,"context_line":"        http_client \u003d httpclient.HTTPClient(endpoint)"},{"line_number":365,"context_line":"        self.assertEqual(endpoint, http_client._make_connection_url(\"\"))"}],"source_content_type":"text/x-python","patch_set":3,"id":"3d6c317e_048e6417","line":362,"updated":"2024-12-06 12:59:25.000000000","message":"nit: this is technically not directly testing _trim_endpoint_api_version\n\nits testing how it was used as a side effect fo other calls but that said it does test your chagne.","commit_id":"5359e7b4ecd53b95ebe17a7af5a7c063d4eb7cb4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c11fbc5bf449e9988045e9591f9168a0388aa198","unresolved":true,"context_lines":[{"line_number":361,"context_line":""},{"line_number":362,"context_line":"    def test_port_ends_with_one(self):"},{"line_number":363,"context_line":"        endpoint \u003d \"http://localhost:8081/\""},{"line_number":364,"context_line":"        http_client \u003d httpclient.HTTPClient(endpoint)"},{"line_number":365,"context_line":"        self.assertEqual(endpoint, http_client._make_connection_url(\"\"))"}],"source_content_type":"text/x-python","patch_set":3,"id":"274513eb_e7fbb99d","line":364,"updated":"2024-12-06 12:59:25.000000000","message":"initallising the client saves the untrimed and trimmed version \n\nhttps://review.opendev.org/c/openstack/python-watcherclient/+/908565/3/watcherclient/common/httpclient.py#193","commit_id":"5359e7b4ecd53b95ebe17a7af5a7c063d4eb7cb4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c11fbc5bf449e9988045e9591f9168a0388aa198","unresolved":true,"context_lines":[{"line_number":362,"context_line":"    def test_port_ends_with_one(self):"},{"line_number":363,"context_line":"        endpoint \u003d \"http://localhost:8081/\""},{"line_number":364,"context_line":"        http_client \u003d httpclient.HTTPClient(endpoint)"},{"line_number":365,"context_line":"        self.assertEqual(endpoint, http_client._make_connection_url(\"\"))"}],"source_content_type":"text/x-python","patch_set":3,"id":"f2135f78_d98ca7f4","line":365,"updated":"2024-12-06 12:59:25.000000000","message":"https://review.opendev.org/c/openstack/python-watcherclient/+/908565/3/watcherclient/common/httpclient.py#279\n\n   def _make_connection_url(self, url):\n        return \u0027%s/%s\u0027 % (self.endpoint_trimmed.rstrip(\u0027/\u0027), url.lstrip(\u0027/\u0027))\n        \n_make_connection_url takes the trimmed version reoves the trailing  / if preesnt and concatonats the url you passed which in this case is the empty string so yes\n\nendpoint shoudl be equal to  http_client._make_connection_url(\"\")\n\nlooking at this code we shoudl replace the use of string manipluation with pathlib or simialr eventually but that is out of scope of the bug fix.","commit_id":"5359e7b4ecd53b95ebe17a7af5a7c063d4eb7cb4"}]}
