Change-Id: I6061cef2ca869eb8286cd03522e3508e327517dd
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
message = f"The following commands or options are only supported with the version v1 of OSM SOL005': {what}"
elif version == "sol005_v2":
message = f"The following commands or options are only supported with the version v2 of OSM SOL005': {what}"
message = f"The following commands or options are only supported with the version v1 of OSM SOL005': {what}"
elif version == "sol005_v2":
message = f"The following commands or options are only supported with the version v2 of OSM SOL005': {what}"
+ else:
+ message = f"The following commands or options are only supported with the version {version} of OSM SOL005': {what}"
fullclassname = obj.__module__ + "." + obj.__class__.__name__
if fullclassname != "osmclient.{}.client.Client".format(version):
raise ClientException(message)
fullclassname = obj.__module__ + "." + obj.__class__.__name__
if fullclassname != "osmclient.{}.client.Client".format(version):
raise ClientException(message)
or package_handling.SOL004_TOSCA == package_type
):
the_package = SOL004Package(package_folder)
or package_handling.SOL004_TOSCA == package_type
):
the_package = SOL004Package(package_folder)
+ else:
+ raise ClientException(f"Unknown package type: {package_type}")
the_package.create_or_update_metadata_file()
the_package.create_or_update_metadata_file()
def __init__(
self,
host=None,
def __init__(
self,
host=None,
user="admin",
password="admin",
project="admin",
user="admin",
password="admin",
project="admin",
self._auth_endpoint = "/admin/v1/tokens"
self._headers = {}
self._token = None
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
- 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)
self._headers["Accept"] = "application/json"
self._headers["Content-Type"] = "application/yaml"
self._http_client.set_http_header(self._headers)
http_code, resp = self._http.get2_cmd(
"{}/{}".format(self._apiBase, uuid)
)
http_code, resp = self._http.get2_cmd(
"{}/{}".format(self._apiBase, uuid)
)
http_code, resp = self._http.get2_cmd(
"{}/{}/{}/{}".format(self._apiBase, uuid, project_name, ns_id)
)
http_code, resp = self._http.get2_cmd(
"{}/{}/{}/{}".format(self._apiBase, uuid, project_name, ns_id)
)
if ns:
ns_instance = self._client.ns.get(ns)
if filter_string:
if ns:
ns_instance = self._client.ns.get(ns)
if filter_string:
- filter_string += ",nsr-id-ref={}".format(ns_instance["_id"])
+ filter_string += "&nsr-id-ref={}".format(ns_instance["_id"])
else:
filter_string = "?nsr-id-ref={}".format(ns_instance["_id"])
_, resp = self._http.get2_cmd("{}{}".format(self._apiBase, filter_string))
else:
filter_string = "?nsr-id-ref={}".format(ns_instance["_id"])
_, resp = self._http.get2_cmd("{}{}".format(self._apiBase, filter_string))
deps = {[testenv]deps}
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements-test.txt
deps = {[testenv]deps}
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements-test.txt
commands =
pylint -E osmclient/
commands =
pylint -E osmclient/