opentelekomcloud / python-otcextensions

Extension of the OpenStackSDK && OpenStackClient with OpenTelekomCloud services
https://docs.otc-service.com/python-otcextensions
Apache License 2.0
24 stars 24 forks source link

Enable OBS monitoring test for EU-CH2 #359

Closed jmiskani closed 11 months ago

jmiskani commented 1 year ago

Please enable OBS monitoring test for EU-CH2. domain is hardcoded in OTCEXTENSIONS for public OTC domains, but the EU-CH2 is different (non-standard) hence it has to be changed how the EU-CH2 domain is used.

vladimirhasko commented 1 year ago

we have currently OBS SDK broken for other regions

2023-09-20 06:01:23.286548 | TASK [Create Container]
2023-09-20 06:01:24.261593 | localhost | ERROR
2023-09-20 06:01:24.261827 | localhost | {
2023-09-20 06:01:24.261867 | localhost |   "changed": true,
2023-09-20 06:01:24.261893 | localhost |   "exception": "NoneType: None\n",
2023-09-20 06:01:24.261916 | localhost |   "msg": "non-zero return code",
2023-09-20 06:01:24.261938 | localhost |   "rc": 1,
2023-09-20 06:01:24.261959 | localhost |   "stderr": "Traceback (most recent call last):\n  File \"/home/apimon/.ansible/tmp/ansible-tmp-1695189683.3033261-2145917-79160665309120/create_container.py\", line 13, in <module>\n    conn.obs.create_container(name=container_name, headers=headers)\n  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/obs/v1/_proxy.py\", line 128, in create_container\n    return self._create(\n  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/sdk_proxy.py\", line 153, in _create\n    persist = res.create(\n  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/obs/v1/container.py\", line 155, in create\n    self._translate_response(response)\n  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/obs/v1/container.py\", line 55, in _translate_response\n    exceptions.raise_from_response(response, error_message=response.text)\n  File \"/usr/local/lib/python3.10/site-packages/otcextensions/common/exc.py\", line 286, in raise_from_response\n    raise cls(\nopenstack.exceptions.BadRequestException: <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Error><Code>IllegalLocationConstraintException</Code><Message>The  location constraint is incompatible for the region specific endpoint this request was sent to.</Message><RequestId>0000018AB12DCF20C00DC38D0ED9A8E4</RequestId><HostId>d2pi+WqeYmIMqToo0oZwO1zDKjAxCdIotqdSsP9MA21e5+3zb6Bij/md7EN30JR+</HostId></Error>: Client Error for url: https://scenario9-26d2114066154a-apimon.obs.eu-nl.otc.t-systems.com/, Bad Request\n",
2023-09-20 06:01:24.261982 | localhost |   "stderr_lines": [
2023-09-20 06:01:24.262002 | localhost |     "Traceback (most recent call last):",
2023-09-20 06:01:24.262023 | localhost |     "  File \"/home/apimon/.ansible/tmp/ansible-tmp-1695189683.3033261-2145917-79160665309120/create_container.py\", line 13, in <module>",
2023-09-20 06:01:24.262043 | localhost |     "    conn.obs.create_container(name=container_name, headers=headers)",
2023-09-20 06:01:24.262064 | localhost |     "  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/obs/v1/_proxy.py\", line 128, in create_container",
2023-09-20 06:01:24.262084 | localhost |     "    return self._create(",
2023-09-20 06:01:24.262104 | localhost |     "  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/sdk_proxy.py\", line 153, in _create",
2023-09-20 06:01:24.262124 | localhost |     "    persist = res.create(",
2023-09-20 06:01:24.262145 | localhost |     "  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/obs/v1/container.py\", line 155, in create",
2023-09-20 06:01:24.262165 | localhost |     "    self._translate_response(response)",
2023-09-20 06:01:24.262185 | localhost |     "  File \"/usr/local/lib/python3.10/site-packages/otcextensions/sdk/obs/v1/container.py\", line 55, in _translate_response",
2023-09-20 06:01:24.262205 | localhost |     "    exceptions.raise_from_response(response, error_message=response.text)",
2023-09-20 06:01:24.262225 | localhost |     "  File \"/usr/local/lib/python3.10/site-packages/otcextensions/common/exc.py\", line 286, in raise_from_response",
2023-09-20 06:01:24.262245 | localhost |     "    raise cls(",
2023-09-20 06:01:24.262265 | localhost |     "openstack.exceptions.BadRequestException: <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Error><Code>IllegalLocationConstraintException</Code><Message>The  location constraint is incompatible for the region specific endpoint this request was sent to.</Message><RequestId>0000018AB12DCF20C00DC38D0ED9A8E4</RequestId><HostId>d2pi+WqeYmIMqToo0oZwO1zDKjAxCdIotqdSsP9MA21e5+3zb6Bij/md7EN30JR+</HostId></Error>: Client Error for url: https://scenario9-26d2114066154a-apimon.obs.eu-nl.otc.t-systems.com/, Bad Request"
2023-09-20 06:01:24.262296 | localhost |   ]
2023-09-20 06:01:24.262317 | localhost | }

apimon triggers simple container creation playbook with this sdk script: https://github.com/opentelekomcloud-infra/apimon-tests/blob/master/playbooks/files/create_container.py

Region seems to be hardcoded on several places in https://github.com/opentelekomcloud/python-otcextensions/blob/master/otcextensions/sdk/obs/v1/_proxy.py (see eu-de references) and eu-nl is not properly taken.

Region and eventually url differs based on different regions currently the obs is only usable in eu-de and not in eu-nl or eu-ch2

anton-sidelnikov commented 1 year ago

Should fix all issues for regions #360

anton-sidelnikov commented 12 months ago

@vladimirhasko @jmiskani please check on 0.30.4