From: tierno Date: Fri, 17 Apr 2020 15:42:35 +0000 (+0000) Subject: fix error when description is not provided at k8s cluster repos X-Git-Tag: v7.1.0rc1^2~9 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F8797%2F1;p=osm%2Fosmclient.git fix error when description is not provided at k8s cluster repos Change-Id: Ic9c5322a3d11cd2a2e639b2ac126200303fb3e04 Signed-off-by: tierno --- diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 40cb542..6245bb3 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -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)) diff --git a/osmclient/sol005/ns.py b/osmclient/sol005/ns.py index dfe46e7..4798bf3 100644 --- a/osmclient/sol005/ns.py +++ b/osmclient/sol005/ns.py @@ -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")