Feature 11037 Changes to work with ingress controller 28/14328/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 23 Apr 2024 08:07:42 +0000 (10:07 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 22 May 2024 13:33:22 +0000 (15:33 +0200)
Change-Id: I75657d047fd528f5a960bdc42281d0b370bf5c0d
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/sol005/client.py

index 5146fe2..fadd377 100644 (file)
@@ -63,17 +63,19 @@ class Client(object):
         self._auth_endpoint = "/admin/v1/tokens"
         self._headers = {}
         self._token = None
-        if len(host.split(":")) > 1:
-            # backwards compatible, port provided as part of host
-            self._host = host.split(":")[0]
-            self._so_port = host.split(":")[1]
+        self._url = None
+        if host.startswith("http://") or host.startswith("https://"):
+            self._url = self._host
         else:
-            self._host = host
-            self._so_port = so_port
-
-        self._http_client = http.Http(
-            "https://{}:{}/osm".format(self._host, self._so_port), **kwargs
-        )
+            if len(host.split(":")) > 1:
+                # backwards compatible, port provided as part of host
+                self._host = host.split(":")[0]
+                self._so_port = host.split(":")[1]
+            else:
+                self._host = host
+                self._so_port = so_port
+            self._url = "https://{}:{}/osm".format(self._host, self._so_port)
+        self._http_client = http.Http(self._url, **kwargs)
         self._headers["Accept"] = "application/json"
         self._headers["Content-Type"] = "application/yaml"
         self._http_client.set_http_header(self._headers)