Fix bug 2373 - Remove old code from v1 client in ns_show 35/14435/1 v15.0
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 19 Jun 2024 08:58:48 +0000 (10:58 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 19 Jun 2024 12:57:20 +0000 (14:57 +0200)
Change-Id: I4cfe351acc7c0ce092236f8f55cd369063b69181
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/cli_commands/ns.py
osmclient/cli_commands/utils.py
osmclient/common/package_tool.py
osmclient/sol005/client.py
osmclient/sol005/ns.py
tox.ini

index 80961d5..a21c492 100755 (executable)
@@ -307,11 +307,6 @@ def ns_show(ctx, name, literal, filter, output):
         if not filter or k in filter:
             table.add_row([k, utils.wrap_text(text=json.dumps(v, indent=2), width=100)])
 
-    nsopdata = ctx.obj.ns.get_opdata(ns["id"])
-    nsr_optdata = nsopdata["nsr:nsr"]
-    for k, v in list(nsr_optdata.items()):
-        if not filter or k in filter:
-            table.add_row([k, utils.wrap_text(json.dumps(v, indent=2), width=100)])
     print_output.print_output(output, table.field_names, table._rows)
 
 
index 9ec03f6..25fc21a 100755 (executable)
@@ -48,6 +48,8 @@ def check_client_version(obj, what, version="sol005"):
         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)
index a2cbd87..b1565ea 100644 (file)
@@ -708,6 +708,8 @@ class PackageTool(object):
                 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()
 
index 5146fe2..cd67a87 100644 (file)
@@ -147,12 +147,3 @@ class Client(object):
             version = resp.split()[2]
             date = resp.split()[4]
         return "{} {}".format(version, date)
-
-    def set_default_params(self, **kwargs):
-        host = kwargs.pop("host", None)
-        if host is not None:
-            self._host = host
-        port = kwargs.pop("port", None)
-        if port is not None:
-            self._so_port = port
-        self._http_client.set_query_admin(**kwargs)
index e8442f9..8328dba 100644 (file)
@@ -613,7 +613,7 @@ class Ns(object):
                 http_code, resp = self._http.get2_cmd(
                     "{}/{}".format(self._apiBase, uuid)
                 )
-            if not uuid:
+            else:  # if not uuid
                 http_code, resp = self._http.get2_cmd(
                     "{}/{}/{}/{}".format(self._apiBase, uuid, project_name, ns_id)
                 )
diff --git a/tox.ini b/tox.ini
index ee43058..607d0d3 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -64,7 +64,7 @@ commands =
 deps =  {[testenv]deps}
         -r{toxinidir}/requirements-dev.txt
         -r{toxinidir}/requirements-test.txt
-        pylint
+        pylint==3.2.2
 commands =
         pylint -E osmclient/