fix error when description is not provided at k8s cluster repos 97/8797/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 17 Apr 2020 15:42:35 +0000 (15:42 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 17 Apr 2020 15:42:35 +0000 (15:42 +0000)
Change-Id: Ic9c5322a3d11cd2a2e639b2ac126200303fb3e04
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osmclient/scripts/osm.py
osmclient/sol005/ns.py

index 40cb542..6245bb3 100755 (executable)
@@ -2718,7 +2718,8 @@ def k8scluster_add(ctx,
     cluster['k8s_version'] = version
     cluster['vim_account'] = vim
     cluster['nets'] = yaml.safe_load(k8s_nets)
-    cluster['description'] = description
+    if description:
+        cluster['description'] = description
     if namespace: cluster['namespace'] = namespace
     if cni: cluster['cni'] = yaml.safe_load(cni)
     ctx.obj.k8scluster.create(name, cluster)
@@ -2877,7 +2878,8 @@ def repo_add(ctx,
     repo['name'] = name
     repo['url'] = uri
     repo['type'] = type
-    repo['description'] = description
+    if description:
+        repo['description'] = description
     ctx.obj.repo.create(name, repo)
     # except ClientException as e:
     #     print(str(e))
index dfe46e7..4798bf3 100644 (file)
@@ -204,10 +204,10 @@ class Ns(object):
                 ns_config["vld"] = ns_config.pop("vim-network-name")
             if "vld" in ns_config:
                 if not isinstance(ns_config["vld"], list):
-                    raise ValueError("Error at --config 'vld' must be a list of dictionaries")
+                    raise ClientException("Error at --config 'vld' must be a list of dictionaries")
                 for vld in ns_config["vld"]:
                     if not isinstance(vld, dict):
-                        raise ValueError("Error at --config 'vld' must be a list of dictionaries")
+                        raise ClientException("Error at --config 'vld' must be a list of dictionaries")
                     if vld.get("vim-network-name"):
                         if isinstance(vld["vim-network-name"], dict):
                             vim_network_name_dict = {}
@@ -223,15 +223,15 @@ class Ns(object):
 
             if "additionalParamsForNs" in ns_config:
                 if not isinstance(ns_config["additionalParamsForNs"], dict):
-                    raise ValueError("Error at --config 'additionalParamsForNs' must be a dictionary")
+                    raise ClientException("Error at --config 'additionalParamsForNs' must be a dictionary")
             if "additionalParamsForVnf" in ns_config:
                 if not isinstance(ns_config["additionalParamsForVnf"], list):
-                    raise ValueError("Error at --config 'additionalParamsForVnf' must be a list")
+                    raise ClientException("Error at --config 'additionalParamsForVnf' must be a list")
                 for additional_param_vnf in ns_config["additionalParamsForVnf"]:
                     if not isinstance(additional_param_vnf, dict):
-                        raise ValueError("Error at --config 'additionalParamsForVnf' items must be dictionaries")
+                        raise ClientException("Error at --config 'additionalParamsForVnf' items must be dictionaries")
                     if not additional_param_vnf.get("member-vnf-index"):
-                        raise ValueError("Error at --config 'additionalParamsForVnf' items must contain "
+                        raise ClientException("Error at --config 'additionalParamsForVnf' items must contain "
                                          "'member-vnf-index'")
             if "wim_account" in ns_config:
                 wim_account = ns_config.pop("wim_account")