parameter -nrpv not fuctioning in toscaparser 37/60937/2
authorshangxdy <shang.xiaodong@zte.com.cn>
Tue, 14 Aug 2018 13:57:35 +0000 (21:57 +0800)
committershangxdy <shang.xiaodong@zte.com.cn>
Tue, 14 Aug 2018 17:38:17 +0000 (01:38 +0800)
In opnfv-toscaparer ver 1.0.1, when passing -nrpv to prohibit the input
parameter validation, i.e.

    toscaparser --template-file <file> -nrpv

The exceptions of type MissingRequiredParameterError are still got
raised. Seems that -nrpv parameter is not working.

JIRA: PARSER-181

Change-Id: If44eefcc2b7bdb360eae023ed2c2cd67789c2128
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
tosca2heat/tosca-parser/toscaparser/common/exception.py

index 67a9f7f..d36a714 100644 (file)
@@ -207,10 +207,14 @@ class ExceptionCollector(object):
 
     @staticmethod
     def removeException(exception_type):
-        if ExceptionCollector.collecting and ExceptionCollector.exceptions:
+        # if ExceptionCollector.collecting and ExceptionCollector.exceptions:
+        if ExceptionCollector.exceptions:
+            tmp_exceptions = []
             for i, e in enumerate(ExceptionCollector.exceptions):
-                if isinstance(e, exception_type):
-                    del ExceptionCollector.exceptions[i]
+                if not isinstance(e, exception_type):
+                    tmp_exceptions.append(e)
+                    # del ExceptionCollector.exceptions[i]
+            ExceptionCollector.exceptions = tmp_exceptions
 
     @staticmethod
     def exceptionsCaught():