Add vfc-catalog UUID non-null protection 25/35625/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Wed, 14 Mar 2018 01:10:38 +0000 (09:10 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Wed, 14 Mar 2018 01:10:38 +0000 (09:10 +0800)
For openo csars, there is no UUID, only has id, so when UUID is not null,
replace id with UUID.

Change-Id: I437dbb6dbb2291a223de2981ae830bab46316d37
Issue-ID: VFC-810
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
catalog/pub/utils/toscaparser/basemodel.py

index 7d2595a..205bdb4 100644 (file)
@@ -161,7 +161,8 @@ class BaseInfoModel(object):
     def buidMetadata(self, tosca):
         if 'metadata' in tosca.tpl:
             self.metadata = copy.deepcopy(tosca.tpl['metadata'])
-            self.metadata['id'] = tosca.tpl['metadata']['UUID']
+            if tosca.tpl['metadata'].get('UUID', ''):
+                self.metadata['id'] = tosca.tpl['metadata']['UUID']
 
     def buildProperties(self, nodeTemplate, parsed_params):
         properties = {}