aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-11-29 14:57:04 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-11-29 14:57:04 +0800
commitab5936e6abd6eaf738dd5c99190dfe5450560de5 (patch)
tree779c9c97edbd3fffe3aa959b4e7f07072a075bbf
parenta456e919420181cbec399f53735b5c335e1e4c4a (diff)
Fix vfc-catalog inputs varification
Change-Id: Id290bbf0c825f68b6f95674ff1fb8ee29f805214 Issue-ID: VFC-596 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--catalog/pub/utils/toscaparser/basemodel.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/catalog/pub/utils/toscaparser/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py
index 8d4c4550..7d2595ad 100644
--- a/catalog/pub/utils/toscaparser/basemodel.py
+++ b/catalog/pub/utils/toscaparser/basemodel.py
@@ -47,15 +47,22 @@ class BaseInfoModel(object):
def _validate_input_params(self, path, params):
valid_params = {}
- """
+ inputs = {}
+ if isinstance(params, list):
+ for param in params:
+ key = param.get('key', 'undefined')
+ value = param.get('value', 'undefined')
+ inputs[key] = value
+ params = inputs
+
if params and len(params) > 0:
tmp = self._create_tosca_template(path, None)
- for key, value in params.items():
- if hasattr(tmp, 'inputs') and len(tmp.inputs) > 0:
- for input_def in tmp.inputs:
- if (input_def.name == key):
- valid_params[key] = DataEntityExt.validate_datatype(input_def.type, value)
- """
+ if isinstance(params, dict):
+ for key, value in params.items():
+ if hasattr(tmp, 'inputs') and len(tmp.inputs) > 0:
+ for input_def in tmp.inputs:
+ if (input_def.name == key):
+ valid_params[key] = DataEntityExt.validate_datatype(input_def.type, value)
return valid_params
def _create_tosca_template(self, file_name, valid_params):